Resume paused scrapes from their cursor
This commit is contained in:
@@ -877,6 +877,33 @@ void (async () => {
|
||||
assert.equal(existsSync(join(dir, `${poster?.hash}.webp`)), true);
|
||||
});
|
||||
|
||||
await test("engine resumes a paused scrape from its cursor", async () => {
|
||||
const first = new FakeBackend([
|
||||
{ messages: [message("500"), message("499")] },
|
||||
{ messages: [message("498")] }
|
||||
]);
|
||||
|
||||
const engine = engineFor(root, first);
|
||||
const started = await engine.start({ channelId: "140", guildId: null, mode: "links", backend: first });
|
||||
engine.stop(started.id);
|
||||
await engine.processQueue();
|
||||
|
||||
let meta = engine.get(started.id);
|
||||
assert.equal(meta?.state, "paused");
|
||||
assert.equal(meta?.cursor, "499");
|
||||
assert.equal(meta?.messages, 2);
|
||||
|
||||
const second = new FakeBackend([{ messages: [message("498")] }]);
|
||||
await engine.resume(started.id, second);
|
||||
await engine.processQueue();
|
||||
|
||||
meta = engine.get(started.id);
|
||||
assert.equal(meta?.state, "done");
|
||||
assert.equal(meta?.messages, 3);
|
||||
assert.equal(meta?.cursor, "498");
|
||||
assert.equal(second.calls[0].before, "499");
|
||||
});
|
||||
|
||||
await test("backfillPreviews fills rows left by a preview-less walk", async () => {
|
||||
const backend = new FakeBackend([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user