chore: Allow passing of page to revisions backfill script
This commit is contained in:
@ -1,15 +1,13 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import "./bootstrap";
|
import "./bootstrap";
|
||||||
import debug from "debug";
|
|
||||||
import { Revision, Document, Event } from "../models";
|
import { Revision, Document, Event } from "../models";
|
||||||
|
|
||||||
const log = debug("server");
|
let page = parseInt(process.argv[2] || "0", 10);
|
||||||
let page = 0;
|
|
||||||
let limit = 100;
|
let limit = 100;
|
||||||
|
|
||||||
export default async function main(exit = false) {
|
export default async function main(exit = false) {
|
||||||
const work = async (page: number) => {
|
const work = async (page: number) => {
|
||||||
log(`Backfill revision events… page ${page}`);
|
console.log(`Backfill revision events… page ${page}`);
|
||||||
|
|
||||||
const revisions = await Revision.findAll({
|
const revisions = await Revision.findAll({
|
||||||
limit,
|
limit,
|
||||||
@ -51,7 +49,7 @@ export default async function main(exit = false) {
|
|||||||
await work(page);
|
await work(page);
|
||||||
|
|
||||||
if (exit) {
|
if (exit) {
|
||||||
log("Backfill complete");
|
console.log("Backfill complete");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user