1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { BackgroundCommand, BackgroundResponse, CrawlStateResponse } from '../types';
|
||||
import { cancelCrawl, cancelCrawlWhenWindowRemoved, resumeCrawl, startCrawl } from './crawlTask';
|
||||
import { cancelCrawl, cancelCrawlWhenWindowRemoved, cancelStaleCrawlWhenWindowMissing, resumeCrawl, startCrawl } from './crawlTask';
|
||||
import { getCrawlTaskState } from './taskState';
|
||||
|
||||
/**
|
||||
@@ -14,6 +14,7 @@ export async function handleInstalled(): Promise<void> {
|
||||
*/
|
||||
export async function handleStartup(): Promise<void> {
|
||||
console.log('[background] startup');
|
||||
await cancelStaleCrawlWhenWindowMissing();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ export async function handleBackgroundCommand(
|
||||
case 'START_CRAWL':
|
||||
return startCrawl(message.payload.platformId);
|
||||
case 'GET_CRAWL_STATE':
|
||||
await cancelStaleCrawlWhenWindowMissing();
|
||||
return { ok: true, data: await getCrawlTaskState() };
|
||||
case 'CANCEL_CRAWL':
|
||||
return cancelCrawl();
|
||||
|
||||
Reference in New Issue
Block a user