Skip to content

Commit 7777b70

Browse files
joelghillJoel Hill
and
Joel Hill
authored
Indexing posts from Jetstream (#13)
* Wrote a client to consume incoming data from a Jetstream instance rather than the full firehose. * Only posts are consumed in the Jetstream client. * Registered users are now periodically synced rather than calculated from incoming follow and unfollow events. * Patch for set cursor to 0.0 on launch. --------- Co-authored-by: Joel Hill <joel.hill@solusguard.com>
1 parent a0a8511 commit 7777b70

35 files changed

+977
-780
lines changed

.vscode/launch.json

+3-18
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,14 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
78
{
8-
"name": "Python: Log Feed",
9-
"type": "debugpy",
10-
"request": "launch",
11-
"program": "${workspaceFolder}/manage.py",
12-
"args": [
13-
"start_feed",
14-
"wss://bsky.network/xrpc",
15-
"--algorithm=logger"
16-
],
17-
"django": true,
18-
"justMyCode": false
19-
},
20-
{
21-
"name": "Python: Index Feed",
9+
"name": "Python: Index Posts",
2210
"type": "debugpy",
2311
"request": "launch",
2412
"program": "${workspaceFolder}/manage.py",
2513
"args": [
2614
"start_feed",
27-
"wss://bsky.network/xrpc",
28-
"--algorithm=flatlanders"
2915
],
3016
"django": true,
3117
"justMyCode": false
@@ -42,7 +28,7 @@
4228
"justMyCode": false
4329
},
4430
{
45-
"name": "Python: labeler",
31+
"name": "Python: Labeler",
4632
"type": "debugpy",
4733
"request": "launch",
4834
"program": "${workspaceFolder}/manage.py",
@@ -53,6 +39,5 @@
5339
"django": true,
5440
"justMyCode": false
5541
}
56-
5742
]
5843
}

.vscode/settings.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,16 @@
33
"tests"
44
],
55
"python.testing.unittestEnabled": false,
6-
"python.testing.pytestEnabled": true
6+
"python.testing.pytestEnabled": true,
7+
"cSpell.words": [
8+
"afrom",
9+
"atproto",
10+
"bsky",
11+
"dids",
12+
"FEEDGEN",
13+
"Flatlander",
14+
"flatlanders",
15+
"Jetstream",
16+
"xrpc"
17+
]
718
}

Pipfile

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ atproto = "*"
1212
python-dotenv = "*"
1313
sentry-sdk = {extras = ["django"], version = "*"}
1414
uvloop = "*"
15+
websockets = "*"
16+
zstandard = "*"
1517

1618
[dev-packages]
1719
djlint = "*"

Pipfile.lock

+116-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/docker_entrypoint

+4-14
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,32 @@ set -e
44

55
start_server() {
66
echo "Starting server..."
7-
/app/.venv/bin/python manage.py migrate
87
exec /app/.venv/bin/gunicorn -c gunicorn.conf.py sk_atp_feed.wsgi
98
}
109

1110
start_indexer() {
12-
echo "Starting indexer..."
13-
exec /app/.venv/bin/python manage.py start_feed "wss://bsky.network/xrpc" --algorithm=flatlanders
11+
echo "Starting posts indexer..."
12+
/app/.venv/bin/python manage.py migrate
13+
exec /app/.venv/bin/python manage.py start_feed
1414
}
1515

1616
start_labeler() {
1717
echo "Starting labeler..."
18-
/app/.venv/bin/python manage.py migrate
1918
exec /app/.venv/bin/python manage.py start_labeler
2019
}
2120

22-
start_nginx() {
23-
echo "Starting server..."
24-
/app/.venv/bin/python manage.py migrate
25-
exec nginx -g "daemon off;"
26-
}
27-
2821
case $1 in
2922
server)
3023
start_server
3124
;;
32-
server)
33-
start_nginx
34-
;;
3525
indexer)
3626
start_indexer
3727
;;
3828
labeler)
3929
start_labeler
4030
;;
4131
*)
42-
echo "Usage: $0 {server|indexer|labeler|nginx}"
32+
echo "Usage: $0 {server|indexer|labeler}"
4333
exit 1
4434
;;
4535
esac

0 commit comments

Comments
 (0)