@dcrays/scheduled-task 0.1.6-beta.3 → 0.1.6-beta.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/scheduled-task",
3
- "version": "0.1.6-beta.3",
3
+ "version": "0.1.6-beta.5",
4
4
  "description": "Persistent client-facing cron automation service for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "plugin/index.js",
package/plugin/index.js CHANGED
@@ -1269,13 +1269,17 @@ var CronAutomationManager = class {
1269
1269
  async dispatchDue() {
1270
1270
  if (this.stopping || this.schedulingPaused)
1271
1271
  return;
1272
+ const claimedJobs = [];
1272
1273
  for (; ; ) {
1273
1274
  const claimed = await this.enqueue(() => this.claimNextDueJob());
1274
1275
  if (!claimed)
1275
1276
  break;
1277
+ claimedJobs.push(claimed);
1278
+ }
1279
+ await Promise.all(claimedJobs.map(async (claimed) => {
1276
1280
  const delivered = await this.deliverTracked(claimed.job, claimed.occurrenceAtMs);
1277
1281
  await this.enqueue(() => this.finalizeScheduledRun(claimed.job.id, claimed.occurrenceAtMs, delivered));
1278
- }
1282
+ }));
1279
1283
  await this.enqueue(async () => {
1280
1284
  this.arm();
1281
1285
  });
package/src/manager.js CHANGED
@@ -573,13 +573,17 @@ export class CronAutomationManager {
573
573
  async dispatchDue() {
574
574
  if (this.stopping || this.schedulingPaused)
575
575
  return;
576
+ const claimedJobs = [];
576
577
  for (;;) {
577
578
  const claimed = await this.enqueue(() => this.claimNextDueJob());
578
579
  if (!claimed)
579
580
  break;
581
+ claimedJobs.push(claimed);
582
+ }
583
+ await Promise.all(claimedJobs.map(async (claimed) => {
580
584
  const delivered = await this.deliverTracked(claimed.job, claimed.occurrenceAtMs);
581
585
  await this.enqueue(() => this.finalizeScheduledRun(claimed.job.id, claimed.occurrenceAtMs, delivered));
582
- }
586
+ }));
583
587
  await this.enqueue(async () => {
584
588
  this.arm();
585
589
  });