oops horrible bug: was re-adding old results

This commit is contained in:
Ahmed Fasih 2022-11-08 20:44:27 -08:00
parent 8346406493
commit d0ab562101

View file

@ -448,7 +448,7 @@ export default class Mastodon implements MegalodonInterface {
const sleep_ms = options?.sleep_ms || 0;
while (parsed?.next) {
const nextRes = await this.client.get<Array<MastodonEntity.Account>>(parsed?.next.url, undefined, undefined, true)
res.data.push(...res.data.map(a => MastodonAPI.Converter.account(a)))
res.data.push(...nextRes.data.map(a => MastodonAPI.Converter.account(a)))
parsed = parseLinkHeader(nextRes.headers.link);
if (sleep_ms) {
await new Promise<void>(res => setTimeout(() => res(), sleep_ms))