Skip to content

Commit

Permalink
Finish up support
Browse files Browse the repository at this point in the history
  • Loading branch information
strideynet committed Aug 15, 2023
1 parent 1e89842 commit 8cda557
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
cloud.google.com/go/cloudsqlconn v1.2.4
connectrpc.com/connect v1.11.0
connectrpc.com/otelconnect v0.5.0
github.com/bluesky-social/indigo v0.0.0-20230810233313-ca1f9da51f09
github.com/bluesky-social/indigo v0.0.0-20230815172301-d9efabf04191
github.com/golang-migrate/migrate/v4 v4.16.2
github.com/google/go-cmp v0.5.9
github.com/gorilla/websocket v1.5.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ github.com/bluesky-social/indigo v0.0.0-20230728184334-c2ae70612145 h1:La+KOOafH
github.com/bluesky-social/indigo v0.0.0-20230728184334-c2ae70612145/go.mod h1:R4lTJrJ8FkabyT9oqn3nIB+49xqcGPNdlHLq2huREjY=
github.com/bluesky-social/indigo v0.0.0-20230810233313-ca1f9da51f09 h1:9Jh/ez4Ie3+YCGhI9agCQcB97AIHjwJvXAu/gEzdcP4=
github.com/bluesky-social/indigo v0.0.0-20230810233313-ca1f9da51f09/go.mod h1:mvd5qjdsWSCYMu8r0Lc+M7FNbBi63mmTMJnPh+F1ghI=
github.com/bluesky-social/indigo v0.0.0-20230811212902-2bdfb5bc4fdc h1:DTZVw4dC40fPdFtQho+++q6B21X58qMMeJKrq2HLwIg=
github.com/bluesky-social/indigo v0.0.0-20230811212902-2bdfb5bc4fdc/go.mod h1:mvd5qjdsWSCYMu8r0Lc+M7FNbBi63mmTMJnPh+F1ghI=
github.com/bluesky-social/indigo v0.0.0-20230815171710-dcd896ab2eb2 h1:gyUHE69cDQc+3DaBfjraoJSH47nIux2z6xt0jRdsSTM=
github.com/bluesky-social/indigo v0.0.0-20230815171710-dcd896ab2eb2/go.mod h1:mvd5qjdsWSCYMu8r0Lc+M7FNbBi63mmTMJnPh+F1ghI=
github.com/bluesky-social/indigo v0.0.0-20230815172301-d9efabf04191 h1:1ecZfDDYbqXLHbbCkLYRSZf2c3rpreqyK/bjb5qKlUY=
github.com/bluesky-social/indigo v0.0.0-20230815172301-d9efabf04191/go.mod h1:mvd5qjdsWSCYMu8r0Lc+M7FNbBi63mmTMJnPh+F1ghI=
github.com/brianvoe/gofakeit/v6 v6.20.2 h1:FLloufuC7NcbHqDzVQ42CG9AKryS1gAGCRt8nQRsW+Y=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
Expand Down
3 changes: 1 addition & 2 deletions ingester/handle_actor_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func (fi *FirehoseIngester) handleActorProfileUpdate(
IndexedAt: time.Now(),
DisplayName: displayName,
Description: description,
// TODO: Extract SelfLabels from post
SelfLabels: []string{},
SelfLabels: selfLabels,
},
)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"github.com/bluesky-social/indigo/events/schedulers/sequential"
"strconv"

"github.com/bluesky-social/indigo/util"
Expand Down Expand Up @@ -259,9 +260,8 @@ func (fi *FirehoseIngester) Start(ctx context.Context) error {
return nil
},
}
return events.HandleRepoStream(ctx, con, &events.SequentialScheduler{
Do: callbacks.EventHandler,
})
scheduler := sequential.NewScheduler("main", callbacks.EventHandler)
return events.HandleRepoStream(ctx, con, scheduler)
// TODO: sometimes stream exits of own accord, we should attempt to
// reconnect and enter an "error state".
})
Expand Down
10 changes: 7 additions & 3 deletions store/gen/candidate_actors.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion store/gen/candidate_posts.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions store/queries/candidate_actors.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ WITH
ap as (
INSERT INTO actor_profiles
(actor_did, commit_cid, created_at, indexed_at, display_name,
description)
description, self_labels)
VALUES
(sqlc.arg(actor_did), sqlc.arg(commit_cid),
sqlc.arg(created_at), sqlc.arg(indexed_at),
sqlc.arg(display_name), sqlc.arg(description))
sqlc.arg(display_name), sqlc.arg(description),
sqlc.arg(self_labels))
ON CONFLICT (actor_did, commit_cid) DO
UPDATE SET
created_at = EXCLUDED.created_at,
indexed_at = EXCLUDED.indexed_at,
display_name = EXCLUDED.display_name,
description = EXCLUDED.description
description = EXCLUDED.description,
self_labels = EXCLUDED.self_labels
RETURNING actor_did, commit_cid)
UPDATE candidate_actors ca
SET
Expand Down
2 changes: 1 addition & 1 deletion store/queries/candidate_posts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ WHERE
-- Filter by NSFW status. If unspecified, do not filter.
AND (sqlc.narg(is_nsfw)::BOOLEAN IS NULL OR
((ARRAY ['nsfw', 'mursuit', 'murrsuit'] && cp.hashtags) OR
ARRAY ['TODO-TEMPORARY'] && cp.self_labels) = @is_nsfw)
(ARRAY ['porn', 'nudity', 'suggestive'] && cp.self_labels)) = @is_nsfw)

-- Remove posts newer than the cursor timestamp
AND (cp.indexed_at < @cursor_timestamp)
Expand Down

0 comments on commit 8cda557

Please sign in to comment.