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