at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol atproto indexer rust fjall

[backfill] add jitter to retry backoff

ptr.pet c9fd3cb4 03425429

verified
+200 -3
+194 -3
Cargo.lock
··· 451 451 checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" 452 452 453 453 [[package]] 454 + name = "chacha20" 455 + version = "0.10.0" 456 + source = "registry+https://github.com/rust-lang/crates.io-index" 457 + checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" 458 + dependencies = [ 459 + "cfg-if", 460 + "cpufeatures 0.3.0", 461 + "rand_core 0.10.0", 462 + ] 463 + 464 + [[package]] 454 465 name = "chrono" 455 466 version = "0.4.43" 456 467 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 632 643 ] 633 644 634 645 [[package]] 646 + name = "cpufeatures" 647 + version = "0.3.0" 648 + source = "registry+https://github.com/rust-lang/crates.io-index" 649 + checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" 650 + dependencies = [ 651 + "libc", 652 + ] 653 + 654 + [[package]] 635 655 name = "crc32fast" 636 656 version = "1.5.0" 637 657 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 715 735 checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" 716 736 dependencies = [ 717 737 "cfg-if", 718 - "cpufeatures", 738 + "cpufeatures 0.2.17", 719 739 "curve25519-dalek-derive", 720 740 "digest", 721 741 "fiat-crypto", ··· 1342 1362 ] 1343 1363 1344 1364 [[package]] 1365 + name = "getrandom" 1366 + version = "0.4.1" 1367 + source = "registry+https://github.com/rust-lang/crates.io-index" 1368 + checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" 1369 + dependencies = [ 1370 + "cfg-if", 1371 + "libc", 1372 + "r-efi", 1373 + "rand_core 0.10.0", 1374 + "wasip2", 1375 + "wasip3", 1376 + ] 1377 + 1378 + [[package]] 1345 1379 name = "gimli" 1346 1380 version = "0.32.3" 1347 1381 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1637 1671 "miette", 1638 1672 "mimalloc", 1639 1673 "n0-future 0.3.2", 1674 + "rand 0.10.0", 1640 1675 "reqwest", 1641 1676 "rmp-serde", 1642 1677 "scc", ··· 1826 1861 ] 1827 1862 1828 1863 [[package]] 1864 + name = "id-arena" 1865 + version = "2.3.0" 1866 + source = "registry+https://github.com/rust-lang/crates.io-index" 1867 + checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" 1868 + 1869 + [[package]] 1829 1870 name = "ident_case" 1830 1871 version = "1.0.1" 1831 1872 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1860 1901 dependencies = [ 1861 1902 "equivalent", 1862 1903 "hashbrown 0.16.1", 1904 + "serde", 1905 + "serde_core", 1863 1906 ] 1864 1907 1865 1908 [[package]] ··· 2295 2338 ] 2296 2339 2297 2340 [[package]] 2341 + name = "leb128fmt" 2342 + version = "0.1.0" 2343 + source = "registry+https://github.com/rust-lang/crates.io-index" 2344 + checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" 2345 + 2346 + [[package]] 2298 2347 name = "libc" 2299 2348 version = "0.2.180" 2300 2349 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3213 3262 ] 3214 3263 3215 3264 [[package]] 3265 + name = "rand" 3266 + version = "0.10.0" 3267 + source = "registry+https://github.com/rust-lang/crates.io-index" 3268 + checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" 3269 + dependencies = [ 3270 + "chacha20", 3271 + "getrandom 0.4.1", 3272 + "rand_core 0.10.0", 3273 + ] 3274 + 3275 + [[package]] 3216 3276 name = "rand_chacha" 3217 3277 version = "0.3.1" 3218 3278 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3251 3311 ] 3252 3312 3253 3313 [[package]] 3314 + name = "rand_core" 3315 + version = "0.10.0" 3316 + source = "registry+https://github.com/rust-lang/crates.io-index" 3317 + checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" 3318 + 3319 + [[package]] 3254 3320 name = "redox_syscall" 3255 3321 version = "0.5.18" 3256 3322 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3800 3866 checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 3801 3867 dependencies = [ 3802 3868 "cfg-if", 3803 - "cpufeatures", 3869 + "cpufeatures 0.2.17", 3804 3870 "digest", 3805 3871 ] 3806 3872 ··· 3817 3883 checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" 3818 3884 dependencies = [ 3819 3885 "cfg-if", 3820 - "cpufeatures", 3886 + "cpufeatures 0.2.17", 3821 3887 "digest", 3822 3888 ] 3823 3889 ··· 4678 4744 ] 4679 4745 4680 4746 [[package]] 4747 + name = "wasip3" 4748 + version = "0.4.0+wasi-0.3.0-rc-2026-01-06" 4749 + source = "registry+https://github.com/rust-lang/crates.io-index" 4750 + checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" 4751 + dependencies = [ 4752 + "wit-bindgen", 4753 + ] 4754 + 4755 + [[package]] 4681 4756 name = "wasm-bindgen" 4682 4757 version = "0.2.108" 4683 4758 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4737 4812 ] 4738 4813 4739 4814 [[package]] 4815 + name = "wasm-encoder" 4816 + version = "0.244.0" 4817 + source = "registry+https://github.com/rust-lang/crates.io-index" 4818 + checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" 4819 + dependencies = [ 4820 + "leb128fmt", 4821 + "wasmparser", 4822 + ] 4823 + 4824 + [[package]] 4825 + name = "wasm-metadata" 4826 + version = "0.244.0" 4827 + source = "registry+https://github.com/rust-lang/crates.io-index" 4828 + checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" 4829 + dependencies = [ 4830 + "anyhow", 4831 + "indexmap", 4832 + "wasm-encoder", 4833 + "wasmparser", 4834 + ] 4835 + 4836 + [[package]] 4740 4837 name = "wasm-streams" 4741 4838 version = "0.4.2" 4742 4839 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4747 4844 "wasm-bindgen", 4748 4845 "wasm-bindgen-futures", 4749 4846 "web-sys", 4847 + ] 4848 + 4849 + [[package]] 4850 + name = "wasmparser" 4851 + version = "0.244.0" 4852 + source = "registry+https://github.com/rust-lang/crates.io-index" 4853 + checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" 4854 + dependencies = [ 4855 + "bitflags", 4856 + "hashbrown 0.15.5", 4857 + "indexmap", 4858 + "semver", 4750 4859 ] 4751 4860 4752 4861 [[package]] ··· 5194 5303 version = "0.51.0" 5195 5304 source = "registry+https://github.com/rust-lang/crates.io-index" 5196 5305 checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" 5306 + dependencies = [ 5307 + "wit-bindgen-rust-macro", 5308 + ] 5309 + 5310 + [[package]] 5311 + name = "wit-bindgen-core" 5312 + version = "0.51.0" 5313 + source = "registry+https://github.com/rust-lang/crates.io-index" 5314 + checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" 5315 + dependencies = [ 5316 + "anyhow", 5317 + "heck 0.5.0", 5318 + "wit-parser", 5319 + ] 5320 + 5321 + [[package]] 5322 + name = "wit-bindgen-rust" 5323 + version = "0.51.0" 5324 + source = "registry+https://github.com/rust-lang/crates.io-index" 5325 + checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" 5326 + dependencies = [ 5327 + "anyhow", 5328 + "heck 0.5.0", 5329 + "indexmap", 5330 + "prettyplease", 5331 + "syn", 5332 + "wasm-metadata", 5333 + "wit-bindgen-core", 5334 + "wit-component", 5335 + ] 5336 + 5337 + [[package]] 5338 + name = "wit-bindgen-rust-macro" 5339 + version = "0.51.0" 5340 + source = "registry+https://github.com/rust-lang/crates.io-index" 5341 + checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" 5342 + dependencies = [ 5343 + "anyhow", 5344 + "prettyplease", 5345 + "proc-macro2", 5346 + "quote", 5347 + "syn", 5348 + "wit-bindgen-core", 5349 + "wit-bindgen-rust", 5350 + ] 5351 + 5352 + [[package]] 5353 + name = "wit-component" 5354 + version = "0.244.0" 5355 + source = "registry+https://github.com/rust-lang/crates.io-index" 5356 + checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" 5357 + dependencies = [ 5358 + "anyhow", 5359 + "bitflags", 5360 + "indexmap", 5361 + "log", 5362 + "serde", 5363 + "serde_derive", 5364 + "serde_json", 5365 + "wasm-encoder", 5366 + "wasm-metadata", 5367 + "wasmparser", 5368 + "wit-parser", 5369 + ] 5370 + 5371 + [[package]] 5372 + name = "wit-parser" 5373 + version = "0.244.0" 5374 + source = "registry+https://github.com/rust-lang/crates.io-index" 5375 + checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" 5376 + dependencies = [ 5377 + "anyhow", 5378 + "id-arena", 5379 + "indexmap", 5380 + "log", 5381 + "semver", 5382 + "serde", 5383 + "serde_derive", 5384 + "serde_json", 5385 + "unicode-xid", 5386 + "wasmparser", 5387 + ] 5197 5388 5198 5389 [[package]] 5199 5390 name = "writeable"
+1
Cargo.toml
··· 45 45 cid = "0.11.1" 46 46 smallvec = "2.0.0-alpha.12" 47 47 thiserror = "2.0.18" 48 + rand = "0.10.0"
+5
src/types.rs
··· 96 96 let cap = 3600; 97 97 let mult = 2u64.pow(retry_count.min(10)) as i64; 98 98 let delay = (base * mult).min(cap); 99 + 100 + // add +/- 10% jitter 101 + let jitter = (rand::random::<f64>() * 0.2 - 0.1) * delay as f64; 102 + let delay = (delay as f64 + jitter) as i64; 103 + 99 104 chrono::Utc::now().timestamp() + delay 100 105 } 101 106 }