i am dealing with a super slowed paged api, limite...
# coroutines
n
i am dealing with a super slowed paged api, limited to a pagesize of 1000 currently i just reqest it concurrently and stop once the result size drops under the requested page size what would be a clean solution to request 10 pages at a time and mark which one results in less results than the requested pagesize ? i was thinking of having a fixedThreadpool process from a channel and the first one that finds the end will somehow trigger that no more jobs are being created.. but not sure how to do this and ofc its not actually guaranted that there is no shifting of data between the requests.. there might be entries added or removed 🤮
g
If API doesn’t provide safe pagination solution you cannot solve it on your side
not sure what you mean about
what would be a clean solution to request 10 pages at a time and mark which one results in less results than the requested pagesize ?
n
i guess what i mean by that is how to process multiple pages at the same time but also limit concurrency to
n
i guess its a worker pool ?
g
Yes, worker pool
but also you can just start 10 coroutines.
Something like that https://pl.kotl.in/r1Dk0EKVV