@zerotal/scheduler 1.5.0 → 1.6.0
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/CHANGELOG.md +9 -0
- package/package.json +2 -2
- package/src/ScheduledTask.ts +4 -1
- package/src/runLog.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,15 @@ follows the Zerotal monorepo's unified versioning.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.6.0] — 2026-08-15
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **Environment-scoped tasks never ran.** `.environments(["production"])` compared against
|
|
16
|
+
`APP_ENV`, which holds the runtime mode (`web`, `worker`, `console`) once the app has
|
|
17
|
+
booted — so a task restricted to any deployment matched nothing and was skipped silently,
|
|
18
|
+
every time. It reads `deployEnv()` now.
|
|
19
|
+
|
|
11
20
|
## [1.5.0] — 2026-08-15
|
|
12
21
|
|
|
13
22
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerotal/scheduler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"maturity": "stable",
|
|
6
6
|
"private": false,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zerotal/core": "1.
|
|
32
|
+
"@zerotal/core": "1.6.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^5.8.0"
|
package/src/ScheduledTask.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { FrameworkEvents } from "@zerotal/core";
|
|
3
|
+
import { deployEnv } from "@zerotal/core";
|
|
3
4
|
import { TaskRan, TaskFailed, TaskSkipped } from "./events.ts";
|
|
4
5
|
import type { LockManager, ManagedLock } from "@zerotal/core/lock";
|
|
5
6
|
import { CronExpression } from "./CronExpression.ts";
|
|
@@ -259,7 +260,9 @@ export class ScheduledTask {
|
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
private _currentEnv(): string {
|
|
262
|
-
|
|
263
|
+
// `deployEnv()`: reading APP_ENV returned the runtime mode, so a task scoped
|
|
264
|
+
// with `.environments(["production"])` never matched and silently never ran.
|
|
265
|
+
return deployEnv() || Bun.env["NODE_ENV"] || "development";
|
|
263
266
|
}
|
|
264
267
|
|
|
265
268
|
private _passesEnvironment(): boolean {
|
package/src/runLog.ts
CHANGED
|
@@ -71,6 +71,7 @@ export function resolveRunLogConfig(app: Application): RunLogConfig {
|
|
|
71
71
|
/* config not resolvable — use the defaults */
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
|
+
// eslint-disable-next-line no-restricted-syntax -- asks about the test runtime mode, not the deployment
|
|
74
75
|
enabled: raw.enabled ?? Bun.env["APP_ENV"] !== "test",
|
|
75
76
|
path: raw.path ?? DEFAULT_RUN_LOG_PATH,
|
|
76
77
|
keep: Math.max(1, raw.keep ?? DEFAULT_RUN_LOG_KEEP),
|