@detiq/crawler 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/job-queue.ts +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@detiq/crawler",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
package/src/job-queue.ts CHANGED
@@ -1551,6 +1551,12 @@ async function processDiscoverJob(jobId: string, config: any, opts?: ProcessJobO
1551
1551
  const controller = new AbortController();
1552
1552
  runningControllers.set(jobId, controller);
1553
1553
 
1554
+ // Independent heartbeat timer — keeps heartbeatAt fresh even when no URLs are
1555
+ // arriving (e.g. during auth login, page-load waits, 2FA handling).
1556
+ const heartbeatTimer = setInterval(() => {
1557
+ void heartbeatJob(tenantId, jobId);
1558
+ }, JOB_HEARTBEAT_INTERVAL_MS);
1559
+
1554
1560
  // Shared accumulator — updated by onUrlsDiscovered callback as each page is visited.
1555
1561
  // This lets the frontend poll and see a growing list before the job finishes.
1556
1562
  const allUrls = new Set<string>();
@@ -1776,6 +1782,7 @@ async function processDiscoverJob(jobId: string, config: any, opts?: ProcessJobO
1776
1782
  })
1777
1783
  ).catch(console.error);
1778
1784
  } finally {
1785
+ clearInterval(heartbeatTimer);
1779
1786
  runningControllers.delete(jobId);
1780
1787
  }
1781
1788
  }