nandi/gleanpublic⑂ Fork 0
⑂ 56b717c
Commits
⬇ Clone ▾
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Increase PDS sync interval to 24 hoursUnverified

Julien Robert committed 2026-05-01T00:49:18+02:00 Browse files
56b717c parent: 947a4c9
modified .env.example +1 -1
@@ -3,7 +3,7 @@ GLEAN_DB=glean.db
33 GLEAN_SESSION_KEY=change-me-to-a-random-string
44 GLEAN_JETSTREAM=wss://jetstream.glean.at
55 GLEAN_PLC_URL=https://didplc.glean.at
6-GLEAN_SYNC_INTERVAL=30m
6+GLEAN_SYNC_INTERVAL=24h
77 GLEAN_CLUSTER_INTERVAL=60m
88 GLEAN_FETCH_INTERVAL=15m
99 GLEAN_COLLECTION_DIR_URL=https://lightrail.microcosm.blue/xrpc/com.atproto.sync.listReposByCollection?collection=at.glean.subscription
@@ -3,7 +3,7 @@ GLEAN_DB=glean.db
3 GLEAN_SESSION_KEY=change-me-to-a-random-string3 GLEAN_SESSION_KEY=change-me-to-a-random-string
4 GLEAN_JETSTREAM=wss://jetstream.glean.at4 GLEAN_JETSTREAM=wss://jetstream.glean.at
5 GLEAN_PLC_URL=https://didplc.glean.at5 GLEAN_PLC_URL=https://didplc.glean.at
6-GLEAN_SYNC_INTERVAL=30m6+GLEAN_SYNC_INTERVAL=24h
7 GLEAN_CLUSTER_INTERVAL=60m7 GLEAN_CLUSTER_INTERVAL=60m
8 GLEAN_FETCH_INTERVAL=15m8 GLEAN_FETCH_INTERVAL=15m
9 GLEAN_COLLECTION_DIR_URL=https://lightrail.microcosm.blue/xrpc/com.atproto.sync.listReposByCollection?collection=at.glean.subscription9 GLEAN_COLLECTION_DIR_URL=https://lightrail.microcosm.blue/xrpc/com.atproto.sync.listReposByCollection?collection=at.glean.subscription
modified internal/server/server.go +4 -0
@@ -395,6 +395,10 @@ func (s *Server) syncUserInBackground(userDID string, client *atproto.Client) {
395395 }()
396396 }
397397
398+// PeriodicSync runs a full PDS sync for all users on a fixed interval.
399+// Jetstream handles real-time create/update/delete events, but gaps can
400+// appear after Jetstream downtime or rare missed events. This catches up by
401+// reconciling each user's PDS records against the local index.
398402 func (s *Server) PeriodicSync(ctx context.Context, interval time.Duration) {
399403 ticker := time.NewTicker(interval)
400404 defer ticker.Stop()
@@ -395,6 +395,10 @@ func (s *Server) syncUserInBackground(userDID string, client *atproto.Client) {
395 }()395 }()
396 }396 }
397 397
398+// PeriodicSync runs a full PDS sync for all users on a fixed interval.
399+// Jetstream handles real-time create/update/delete events, but gaps can
400+// appear after Jetstream downtime or rare missed events. This catches up by
401+// reconciling each user's PDS records against the local index.
398 func (s *Server) PeriodicSync(ctx context.Context, interval time.Duration) {402 func (s *Server) PeriodicSync(ctx context.Context, interval time.Duration) {
399 ticker := time.NewTicker(interval)403 ticker := time.NewTicker(interval)
400 defer ticker.Stop()404 defer ticker.Stop()
modified main.go +1 -1
@@ -25,7 +25,7 @@ func main() {
2525 addr := flag.String("addr", envOr("GLEAN_ADDR", ":8080"), "listen address")
2626 dbPath := flag.String("db", envOr("GLEAN_DB", "glean.db"), "database path")
2727 jetstreamURL := flag.String("jetstream", envOr("GLEAN_JETSTREAM", "wss://jetstream.glean.at"), "Jetstream URL")
28- syncInterval := flag.Duration("sync-interval", envDuration("GLEAN_SYNC_INTERVAL", 30*time.Minute), "PDS sync interval")
28+ syncInterval := flag.Duration("sync-interval", envDuration("GLEAN_SYNC_INTERVAL", 24*time.Hour), "PDS sync interval")
2929 clusterInterval := flag.Duration("cluster-interval", envDuration("GLEAN_CLUSTER_INTERVAL", 1*time.Hour), "cluster recomputation interval")
3030 fetchInterval := flag.Duration("fetch-interval", envDuration("GLEAN_FETCH_INTERVAL", 15*time.Minute), "feed fetch tick interval")
3131 collectionDirURL := flag.String("collection-dir", envOr("GLEAN_COLLECTION_DIR_URL", ""), "collection directory URL for startup backfill")
@@ -25,7 +25,7 @@ func main() {
25 addr := flag.String("addr", envOr("GLEAN_ADDR", ":8080"), "listen address")25 addr := flag.String("addr", envOr("GLEAN_ADDR", ":8080"), "listen address")
26 dbPath := flag.String("db", envOr("GLEAN_DB", "glean.db"), "database path")26 dbPath := flag.String("db", envOr("GLEAN_DB", "glean.db"), "database path")
27 jetstreamURL := flag.String("jetstream", envOr("GLEAN_JETSTREAM", "wss://jetstream.glean.at"), "Jetstream URL")27 jetstreamURL := flag.String("jetstream", envOr("GLEAN_JETSTREAM", "wss://jetstream.glean.at"), "Jetstream URL")
28- syncInterval := flag.Duration("sync-interval", envDuration("GLEAN_SYNC_INTERVAL", 30*time.Minute), "PDS sync interval")28+ syncInterval := flag.Duration("sync-interval", envDuration("GLEAN_SYNC_INTERVAL", 24*time.Hour), "PDS sync interval")
29 clusterInterval := flag.Duration("cluster-interval", envDuration("GLEAN_CLUSTER_INTERVAL", 1*time.Hour), "cluster recomputation interval")29 clusterInterval := flag.Duration("cluster-interval", envDuration("GLEAN_CLUSTER_INTERVAL", 1*time.Hour), "cluster recomputation interval")
30 fetchInterval := flag.Duration("fetch-interval", envDuration("GLEAN_FETCH_INTERVAL", 15*time.Minute), "feed fetch tick interval")30 fetchInterval := flag.Duration("fetch-interval", envDuration("GLEAN_FETCH_INTERVAL", 15*time.Minute), "feed fetch tick interval")
31 collectionDirURL := flag.String("collection-dir", envOr("GLEAN_COLLECTION_DIR_URL", ""), "collection directory URL for startup backfill")31 collectionDirURL := flag.String("collection-dir", envOr("GLEAN_COLLECTION_DIR_URL", ""), "collection directory URL for startup backfill")
modified readme.md +1 -1
@@ -57,7 +57,7 @@ Then open `http://localhost:8080`.
5757 | `GLEAN_ADDR` | `:8080` | Listen address |
5858 | `GLEAN_DB` | `glean.db` | SQLite base path (`_users`, `_articles`, `_recs` suffixes) |
5959 | `GLEAN_JETSTREAM` | `wss://jetstream.glean.at` | Jetstream WebSocket URL |
60-| `GLEAN_SYNC_INTERVAL` | `30m` | PDS sync interval (Go duration: `30m`, `2h30m`, etc.) |
60+| `GLEAN_SYNC_INTERVAL` | `24h` | PDS sync interval (Go duration: `24h`, `12h`, etc.) |
6161 | `GLEAN_CLUSTER_INTERVAL` | `1h` | Cluster recomputation interval (Go duration) |
6262 | `GLEAN_FETCH_INTERVAL` | `15m` | Feed fetch scheduler tick interval (Go duration) |
6363 | `GLEAN_COLLECTION_DIR_URL` | _(empty)_ | Collection directory URL for startup backfill |
@@ -57,7 +57,7 @@ Then open `http://localhost:8080`.
57 | `GLEAN_ADDR` | `:8080` | Listen address |57 | `GLEAN_ADDR` | `:8080` | Listen address |
58 | `GLEAN_DB` | `glean.db` | SQLite base path (`_users`, `_articles`, `_recs` suffixes) |58 | `GLEAN_DB` | `glean.db` | SQLite base path (`_users`, `_articles`, `_recs` suffixes) |
59 | `GLEAN_JETSTREAM` | `wss://jetstream.glean.at` | Jetstream WebSocket URL |59 | `GLEAN_JETSTREAM` | `wss://jetstream.glean.at` | Jetstream WebSocket URL |
60-| `GLEAN_SYNC_INTERVAL` | `30m` | PDS sync interval (Go duration: `30m`, `2h30m`, etc.) |60+| `GLEAN_SYNC_INTERVAL` | `24h` | PDS sync interval (Go duration: `24h`, `12h`, etc.) |
61 | `GLEAN_CLUSTER_INTERVAL` | `1h` | Cluster recomputation interval (Go duration) |61 | `GLEAN_CLUSTER_INTERVAL` | `1h` | Cluster recomputation interval (Go duration) |
62 | `GLEAN_FETCH_INTERVAL` | `15m` | Feed fetch scheduler tick interval (Go duration) |62 | `GLEAN_FETCH_INTERVAL` | `15m` | Feed fetch scheduler tick interval (Go duration) |
63 | `GLEAN_COLLECTION_DIR_URL` | _(empty)_ | Collection directory URL for startup backfill |63 | `GLEAN_COLLECTION_DIR_URL` | _(empty)_ | Collection directory URL for startup backfill |