Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): interrupted scheduled task runs no longer stay busy #28474

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/28474/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 69 additions and 1 deletion (loading 2).

x
0 of 3 viewed, 3 left
69 additions and 1 deletionapps/server/src/scheduledTasks/ScheduledTaskService.test.tsModified
View file
@@ -2,7 +2,7 @@
import * as NodeUtil from "node:util";
​
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
-import { assert, it } from "@effect/vitest";
+import { assert, it, vi } from "@effect/vitest";
import {
ProjectId,
ProviderInstanceId,
@@ -12,6 +12,7 @@
} from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
+import * as Exit from "effect/Exit";
import * as Layer from "effect/Layer";
import * as Logger from "effect/Logger";
import * as SqlClient from "effect/sql/SqlClient";
@@ -476,3 +477,70 @@
}).pipe(Effect.provide(layer));
}).pipe(Effect.provide(SqlitePersistence.layerMemory)),
+​
+it.effect("a run interrupted right after it reserves the task does not block the next run", () =>
+ Effect.gen(function* () {
+ const launches = yield* Ref.make(0);
+ const layer = ScheduledTaskService.layer.pipe(
+ Layer.provide(
+ Layer.mergeAll(