fix: Document subscriptions backfill not recursive
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import "./bootstrap";
|
||||
import { Subscription, Document } from "@server/models";
|
||||
|
||||
const limit = 100;
|
||||
const limit = 1000;
|
||||
let page = parseInt(process.argv[2], 10);
|
||||
page = Number.isNaN(page) ? 0 : page;
|
||||
|
||||
export default async function main(exit = false) {
|
||||
const work = async (page: number) => {
|
||||
const work = async (page: number): Promise<void> => {
|
||||
console.log(`Backfill subscription… page ${page}`);
|
||||
|
||||
// Retrieve all documents within set limit.
|
||||
@@ -36,6 +36,8 @@ export default async function main(exit = false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return documents.length === limit ? work(page + 1) : undefined;
|
||||
};
|
||||
|
||||
await work(page);
|
||||
|
||||
Reference in New Issue
Block a user