A from-scratch atproto PDS implementation in Python (mirrors https://github.com/DavidBuchanan314/millipds)

partial revert of cfaa18fad947206fd96a2f30471b413fb65a81b3

+5 -6
+2 -3
src/millipds/atproto_repo.py
··· 220 220 if limit < 1 or limit > 100: 221 221 raise web.HTTPBadRequest(text="limit out of range") 222 222 reverse = request.query.get("reverse") == "true" 223 - cursor = request.query.get("cursor", "") 224 - if not reverse and not cursor: 225 - cursor = "\xff" # compares greater than all valid rkeys 223 + # note: "" compares less than all valid rkeys, "\xff" greater than. 224 + cursor = request.query.get("cursor", "" if reverse else "\xff") 226 225 did_or_handle = request.query["repo"] 227 226 collection = request.query["collection"] 228 227 records = []
+3 -3
src/millipds/atproto_sync.py
··· 190 190 limit = int(request.query.get("limit", 500)) 191 191 if limit < 1 or limit > 1000: 192 192 raise web.HTTPBadRequest(text="limit out of range") 193 - cursor = int(request.query.get("cursor") or 0) 193 + cursor = int(request.query.get("cursor", 0)) 194 194 195 195 cids = [] 196 196 for id_, cid in get_db(request).con.execute( ··· 246 246 await ws.prepare(request) # TODO: should this be outside of try? 247 247 248 248 last_sent_seq = None 249 - if cursor_str := request.query.get("cursor"): 249 + if "cursor" in request.query: 250 250 # TODO: try to limit number of concurrent backfillers? (it's more expensive than livetailing) 251 - cursor = int(cursor_str) 251 + cursor = int(request.query["cursor"]) 252 252 db = get_db(request) 253 253 while True: 254 254 # we read one at a time to force gaps between reads - could be a perf win to read in small batches