@cedarjs/jobs 5.0.7-next.338 → 5.0.7

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 (42) hide show
  1. package/dist/adapters/BaseAdapter/BaseAdapter.d.ts +1 -24
  2. package/dist/adapters/BaseAdapter/BaseAdapter.d.ts.map +1 -1
  3. package/dist/adapters/BaseAdapter/BaseAdapter.js +28 -4
  4. package/dist/adapters/PrismaAdapter/PrismaAdapter.d.ts +7 -20
  5. package/dist/adapters/PrismaAdapter/PrismaAdapter.d.ts.map +1 -1
  6. package/dist/adapters/PrismaAdapter/PrismaAdapter.js +48 -80
  7. package/dist/adapters/PrismaAdapter/errors.js +28 -4
  8. package/dist/bins/cedar-jobs-worker.js +60 -25
  9. package/dist/bins/cedar-jobs.js +72 -35
  10. package/dist/bins/rw-jobs-worker.js +2 -1
  11. package/dist/consts.d.ts +0 -9
  12. package/dist/consts.d.ts.map +1 -1
  13. package/dist/consts.js +52 -6
  14. package/dist/core/Executor.d.ts +0 -7
  15. package/dist/core/Executor.d.ts.map +1 -1
  16. package/dist/core/Executor.js +52 -79
  17. package/dist/core/JobManager.d.ts +1 -3
  18. package/dist/core/JobManager.d.ts.map +1 -1
  19. package/dist/core/JobManager.js +33 -12
  20. package/dist/core/Scheduler.d.ts +1 -11
  21. package/dist/core/Scheduler.d.ts.map +1 -1
  22. package/dist/core/Scheduler.js +38 -40
  23. package/dist/core/Worker.d.ts.map +1 -1
  24. package/dist/core/Worker.js +40 -24
  25. package/dist/errors.d.ts +0 -14
  26. package/dist/errors.d.ts.map +1 -1
  27. package/dist/errors.js +41 -16
  28. package/dist/index.d.ts +0 -4
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +38 -13
  31. package/dist/loaders.d.ts +1 -6
  32. package/dist/loaders.d.ts.map +1 -1
  33. package/dist/loaders.js +55 -29
  34. package/dist/setupEnv.js +28 -4
  35. package/dist/types.d.ts +5 -10
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js +16 -0
  38. package/dist/util.js +28 -4
  39. package/package.json +14 -12
  40. package/dist/core/executionContext.d.ts +0 -33
  41. package/dist/core/executionContext.d.ts.map +0 -1
  42. package/dist/core/executionContext.js +0 -9
@@ -1,23 +1,59 @@
1
1
  #!/usr/bin/env node
2
- import { fork, exec } from "node:child_process";
3
- import console from "node:console";
4
- import path from "node:path";
5
- import process from "node:process";
6
- import { setTimeout } from "node:timers";
7
- import { hideBin } from "yargs/helpers";
8
- import yargs from "yargs/yargs";
9
- import { DEFAULT_LOGGER, PROCESS_TITLE_PREFIX } from "../consts.js";
10
- import { loadJobsManager } from "../loaders.js";
11
- import { setupEnv } from "../setupEnv.js";
12
- setupEnv();
13
- process.title = "cedar-jobs";
14
- const WORKER_PATH = path.join(import.meta.dirname, "cedar-jobs-worker.js");
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var cedar_jobs_exports = {};
31
+ __export(cedar_jobs_exports, {
32
+ buildNumWorkers: () => buildNumWorkers,
33
+ clearQueue: () => clearQueue,
34
+ startWorkers: () => startWorkers,
35
+ stopWorkers: () => stopWorkers
36
+ });
37
+ module.exports = __toCommonJS(cedar_jobs_exports);
38
+ var import_node_child_process = require("node:child_process");
39
+ var import_node_console = __toESM(require("node:console"));
40
+ var import_node_path = __toESM(require("node:path"));
41
+ var import_node_process = __toESM(require("node:process"));
42
+ var import_node_timers = require("node:timers");
43
+ var import_helpers = require("yargs/helpers");
44
+ var import_yargs = __toESM(require("yargs/yargs"));
45
+ var import_consts = require("../consts.js");
46
+ var import_loaders = require("../loaders.js");
47
+ var import_setupEnv = require("../setupEnv.js");
48
+ (0, import_setupEnv.setupEnv)();
49
+ import_node_process.default.title = "cedar-jobs";
50
+ const WORKER_PATH = import_node_path.default.join(__dirname, "cedar-jobs-worker.js");
15
51
  const parseArgs = (argv) => {
16
- const commandString = hideBin(argv);
52
+ const commandString = (0, import_helpers.hideBin)(argv);
17
53
  if (commandString.length === 1 && commandString[0] === "jobs") {
18
54
  commandString.shift();
19
55
  }
20
- const parsed = yargs(commandString).usage(
56
+ const parsed = (0, import_yargs.default)(commandString).usage(
21
57
  "Starts the CedarJS Jobs runner to process background jobs\n\nUsage: cedar jobs <command> [options]"
22
58
  ).command("work", "Start a worker and process jobs").command("workoff", "Start a worker and exit after all jobs processed").command("start", "Start workers in daemon mode").command("stop", "Stop any daemonized job workers").command("restart", "Stop and start any daemonized job workers").command("clear", "Clear the job queue").demandCommand(1, "You must specify a mode to start in").example(
23
59
  "cedar jobs work",
@@ -28,7 +64,7 @@ const parseArgs = (argv) => {
28
64
  ).help().parse(commandString, (_err, _argv, output) => {
29
65
  if (output) {
30
66
  const newOutput = output.replaceAll("cedar-jobs.js", "cedar jobs");
31
- console.log(newOutput);
67
+ import_node_console.default.log(newOutput);
32
68
  }
33
69
  });
34
70
  return { command: parsed._[0] };
@@ -54,10 +90,10 @@ const startWorkers = ({
54
90
  if (workoff) {
55
91
  workerArgs.push("--workoff");
56
92
  }
57
- const worker = fork(WORKER_PATH, workerArgs, {
93
+ const worker = (0, import_node_child_process.fork)(WORKER_PATH, workerArgs, {
58
94
  detached: detach,
59
95
  stdio: detach ? "ignore" : "inherit",
60
- env: process.env
96
+ env: import_node_process.default.env
61
97
  });
62
98
  if (detach) {
63
99
  worker.unref();
@@ -83,22 +119,22 @@ const stopWorkers = async ({
83
119
  }
84
120
  for (const processId of processIds) {
85
121
  logger.info(`Stopping process id ${processId}...`);
86
- process.kill(processId, signal);
122
+ import_node_process.default.kill(processId, signal);
87
123
  while ((await findWorkerProcesses(processId)).length) {
88
- await new Promise((resolve) => setTimeout(resolve, 250));
124
+ await new Promise((resolve) => (0, import_node_timers.setTimeout)(resolve, 250));
89
125
  }
90
126
  }
91
127
  };
92
128
  const clearQueue = ({ logger }) => {
93
129
  logger.warn(`Starting worker to clear job queue...`);
94
- fork(WORKER_PATH, ["--clear", "--index", "0", "--id", "0"]);
130
+ (0, import_node_child_process.fork)(WORKER_PATH, ["--clear", "--index", "0", "--id", "0"]);
95
131
  };
96
132
  const signalSetup = ({
97
133
  workers,
98
134
  logger
99
135
  }) => {
100
136
  let sigtermCount = 0;
101
- process.on("SIGINT", () => {
137
+ import_node_process.default.on("SIGINT", () => {
102
138
  sigtermCount++;
103
139
  let message = "SIGINT received: shutting down workers gracefully (press Ctrl-C again to exit immediately)...";
104
140
  if (sigtermCount > 1) {
@@ -116,12 +152,12 @@ const signalSetup = ({
116
152
  };
117
153
  const findWorkerProcesses = async (id) => {
118
154
  return new Promise(function(resolve, reject) {
119
- const platform = process.platform;
120
- const cmd = platform === "win32" ? "tasklist" : platform === "darwin" ? "ps -ax | grep " + PROCESS_TITLE_PREFIX : platform === "linux" ? "ps -A" : "";
155
+ const platform = import_node_process.default.platform;
156
+ const cmd = platform === "win32" ? "tasklist" : platform === "darwin" ? "ps -ax | grep " + import_consts.PROCESS_TITLE_PREFIX : platform === "linux" ? "ps -A" : "";
121
157
  if (cmd === "") {
122
158
  resolve([]);
123
159
  }
124
- exec(cmd, function(err, stdout) {
160
+ (0, import_node_child_process.exec)(cmd, function(err, stdout) {
125
161
  if (err) {
126
162
  reject(err);
127
163
  }
@@ -145,17 +181,17 @@ const findWorkerProcesses = async (id) => {
145
181
  });
146
182
  };
147
183
  const main = async () => {
148
- const { command } = parseArgs(process.argv);
184
+ const { command } = parseArgs(import_node_process.default.argv);
149
185
  let jobsConfig;
150
186
  try {
151
- jobsConfig = await loadJobsManager();
187
+ jobsConfig = await (0, import_loaders.loadJobsManager)();
152
188
  } catch (e) {
153
- console.error(e);
154
- process.exit(1);
189
+ import_node_console.default.error(e);
190
+ import_node_process.default.exit(1);
155
191
  }
156
192
  const workerConfig = jobsConfig.workers;
157
193
  const numWorkers = buildNumWorkers(workerConfig);
158
- const logger = jobsConfig.logger ?? DEFAULT_LOGGER;
194
+ const logger = jobsConfig.logger ?? import_consts.DEFAULT_LOGGER;
159
195
  logger.warn(`Starting CedarJS Jobs Runner at ${(/* @__PURE__ */ new Date()).toISOString()}...`);
160
196
  switch (command) {
161
197
  case "start":
@@ -164,7 +200,7 @@ const main = async () => {
164
200
  detach: true,
165
201
  logger
166
202
  });
167
- return process.exit(0);
203
+ return import_node_process.default.exit(0);
168
204
  case "stop":
169
205
  return await stopWorkers({
170
206
  numWorkers,
@@ -178,7 +214,7 @@ const main = async () => {
178
214
  detach: true,
179
215
  logger
180
216
  });
181
- return process.exit(0);
217
+ return import_node_process.default.exit(0);
182
218
  case "work":
183
219
  return signalSetup({
184
220
  workers: startWorkers({
@@ -200,12 +236,13 @@ const main = async () => {
200
236
  return clearQueue({ logger });
201
237
  }
202
238
  };
203
- if (process.env.NODE_ENV !== "test") {
239
+ if (import_node_process.default.env.NODE_ENV !== "test") {
204
240
  main();
205
241
  }
206
- export {
242
+ // Annotate the CommonJS export names for ESM import in node:
243
+ 0 && (module.exports = {
207
244
  buildNumWorkers,
208
245
  clearQueue,
209
246
  startWorkers,
210
247
  stopWorkers
211
- };
248
+ });
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
2
3
  console.warn();
3
4
  console.warn(
4
5
  "'rw-jobs-worker' has been deprecated. Please use 'cedar-jobs-worker' instead."
5
6
  );
6
7
  console.warn();
7
- await import("./cedar-jobs-worker.js");
8
+ require("./cedar-jobs-worker.js");
package/dist/consts.d.ts CHANGED
@@ -1,15 +1,6 @@
1
1
  export declare const DEFAULT_MAX_ATTEMPTS = 24;
2
2
  /** 4 hours in seconds */
3
3
  export declare const DEFAULT_MAX_RUNTIME = 14400;
4
- /**
5
- * Extra time, in seconds, beyond `maxRuntime` before another worker may treat
6
- * a job's lock as abandoned. The worker that locked the job enforces its own
7
- * `maxRuntime` timeout, so this grace period gives it time to record the
8
- * timeout and mark the job as failed without a second worker claiming (and
9
- * re-executing) the job while that's happening. Only jobs whose worker died
10
- * without cleaning up after itself are ever claimed this way.
11
- */
12
- export declare const MAX_RUNTIME_GRACE_PERIOD = 60;
13
4
  /** 5 seconds */
14
5
  export declare const DEFAULT_SLEEP_DELAY = 5;
15
6
  export declare const DEFAULT_DELETE_SUCCESSFUL_JOBS = true;
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,KAAK,CAAA;AACtC,yBAAyB;AACzB,eAAO,MAAM,mBAAmB,QAAS,CAAA;AACzC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,gBAAgB;AAChB,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAClD,eAAO,MAAM,0BAA0B,QAAQ,CAAA;AAC/C,eAAO,MAAM,cAAc,SAAU,CAAA;AACrC,eAAO,MAAM,aAAa,YAAY,CAAA;AACtC,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAClC,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,kBAAkB,MAAO,CAAA;AACtC,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAEvD,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAC7C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,KAAK,CAAA;AACtC,yBAAyB;AACzB,eAAO,MAAM,mBAAmB,QAAS,CAAA;AACzC,gBAAgB;AAChB,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAClD,eAAO,MAAM,0BAA0B,QAAQ,CAAA;AAC/C,eAAO,MAAM,cAAc,SAAU,CAAA;AACrC,eAAO,MAAM,aAAa,YAAY,CAAA;AACtC,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAClC,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,kBAAkB,MAAO,CAAA;AACtC,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAEvD,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YAAY,CAAA;AAC7C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAA"}
package/dist/consts.js CHANGED
@@ -1,11 +1,57 @@
1
- import console from "node:console";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var consts_exports = {};
30
+ __export(consts_exports, {
31
+ DEFAULT_ADAPTER_NAME: () => DEFAULT_ADAPTER_NAME,
32
+ DEFAULT_DELETE_FAILED_JOBS: () => DEFAULT_DELETE_FAILED_JOBS,
33
+ DEFAULT_DELETE_SUCCESSFUL_JOBS: () => DEFAULT_DELETE_SUCCESSFUL_JOBS,
34
+ DEFAULT_LOGGER: () => DEFAULT_LOGGER,
35
+ DEFAULT_LOGGER_NAME: () => DEFAULT_LOGGER_NAME,
36
+ DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS,
37
+ DEFAULT_MAX_RUNTIME: () => DEFAULT_MAX_RUNTIME,
38
+ DEFAULT_MODEL_NAME: () => DEFAULT_MODEL_NAME,
39
+ DEFAULT_PRIORITY: () => DEFAULT_PRIORITY,
40
+ DEFAULT_QUEUE: () => DEFAULT_QUEUE,
41
+ DEFAULT_SLEEP_DELAY: () => DEFAULT_SLEEP_DELAY,
42
+ DEFAULT_WAIT: () => DEFAULT_WAIT,
43
+ DEFAULT_WAIT_UNTIL: () => DEFAULT_WAIT_UNTIL,
44
+ DEFAULT_WORK_QUEUE: () => DEFAULT_WORK_QUEUE,
45
+ PROCESS_TITLE_PREFIX: () => PROCESS_TITLE_PREFIX
46
+ });
47
+ module.exports = __toCommonJS(consts_exports);
48
+ var import_node_console = __toESM(require("node:console"));
2
49
  const DEFAULT_MAX_ATTEMPTS = 24;
3
50
  const DEFAULT_MAX_RUNTIME = 14400;
4
- const MAX_RUNTIME_GRACE_PERIOD = 60;
5
51
  const DEFAULT_SLEEP_DELAY = 5;
6
52
  const DEFAULT_DELETE_SUCCESSFUL_JOBS = true;
7
53
  const DEFAULT_DELETE_FAILED_JOBS = false;
8
- const DEFAULT_LOGGER = console;
54
+ const DEFAULT_LOGGER = import_node_console.default;
9
55
  const DEFAULT_QUEUE = "default";
10
56
  const DEFAULT_WORK_QUEUE = "*";
11
57
  const DEFAULT_PRIORITY = 50;
@@ -15,7 +61,8 @@ const PROCESS_TITLE_PREFIX = "cedar-jobs-worker";
15
61
  const DEFAULT_MODEL_NAME = "BackgroundJob";
16
62
  const DEFAULT_ADAPTER_NAME = "adapter";
17
63
  const DEFAULT_LOGGER_NAME = "logger";
18
- export {
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
19
66
  DEFAULT_ADAPTER_NAME,
20
67
  DEFAULT_DELETE_FAILED_JOBS,
21
68
  DEFAULT_DELETE_SUCCESSFUL_JOBS,
@@ -30,6 +77,5 @@ export {
30
77
  DEFAULT_WAIT,
31
78
  DEFAULT_WAIT_UNTIL,
32
79
  DEFAULT_WORK_QUEUE,
33
- MAX_RUNTIME_GRACE_PERIOD,
34
80
  PROCESS_TITLE_PREFIX
35
- };
81
+ });
@@ -6,11 +6,6 @@ export interface ExecutorOptions {
6
6
  logger?: BasicLogger;
7
7
  /** Defaults to DEFAULT_MAX_ATTEMPTS */
8
8
  maxAttempts?: number;
9
- /**
10
- * The maximum amount of time, in seconds, that the job is allowed to run
11
- * before it is marked as failed. Defaults to DEFAULT_MAX_RUNTIME
12
- */
13
- maxRuntime?: number;
14
9
  /** Defaults to DEFAULT_DELETE_FAILED_JOBS */
15
10
  deleteFailedJobs?: boolean;
16
11
  /** Defaults to DEFAULT_DELETE_SUCCESSFUL_JOBS */
@@ -19,7 +14,6 @@ export interface ExecutorOptions {
19
14
  export declare const DEFAULTS: {
20
15
  logger: Console;
21
16
  maxAttempts: number;
22
- maxRuntime: number;
23
17
  deleteFailedJobs: boolean;
24
18
  deleteSuccessfulJobs: boolean;
25
19
  };
@@ -29,7 +23,6 @@ export declare class Executor {
29
23
  logger: NonNullable<ExecutorOptions['logger']>;
30
24
  job: BaseJob;
31
25
  maxAttempts: NonNullable<ExecutorOptions['maxAttempts']>;
32
- maxRuntime: NonNullable<ExecutorOptions['maxRuntime']>;
33
26
  deleteFailedJobs: NonNullable<ExecutorOptions['deleteFailedJobs']>;
34
27
  deleteSuccessfulJobs: NonNullable<ExecutorOptions['deleteSuccessfulJobs']>;
35
28
  constructor(options: ExecutorOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"Executor.d.ts","sourceRoot":"","sources":["../../src/core/Executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAczE,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAIvD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA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,CAAA;IAC1B,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAA;AAED,qBAAa,QAAQ;IACnB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAA;IAClC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC9C,GAAG,EAAE,OAAO,CAAA;IACZ,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAA;IACxD,gBAAgB,EAAE,WAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAClE,oBAAoB,EAAE,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAAA;gBAE9D,OAAO,EAAE,eAAe;IAmBpC,IAAI,aAAa,WAEhB;IAEK,OAAO;IA2Cb,mBAAmB,CAAC,QAAQ,EAAE,MAAM;CAGrC"}
@@ -1,25 +1,36 @@
1
- import { setTimeout, clearTimeout } from "node:timers";
2
- import { CronExpressionParser } from "cron-parser";
3
- import {
4
- DEFAULT_MAX_ATTEMPTS,
5
- DEFAULT_MAX_RUNTIME,
6
- DEFAULT_DELETE_FAILED_JOBS,
7
- DEFAULT_DELETE_SUCCESSFUL_JOBS,
8
- DEFAULT_LOGGER
9
- } from "../consts.js";
10
- import {
11
- AdapterRequiredError,
12
- JobRequiredError,
13
- JobTimeoutError
14
- } from "../errors.js";
15
- import { loadJob } from "../loaders.js";
16
- import { executionContext } from "./executionContext.js";
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Executor_exports = {};
20
+ __export(Executor_exports, {
21
+ DEFAULTS: () => DEFAULTS,
22
+ Executor: () => Executor
23
+ });
24
+ module.exports = __toCommonJS(Executor_exports);
25
+ var import_cron_parser = require("cron-parser");
26
+ var import_consts = require("../consts.js");
27
+ var import_errors = require("../errors.js");
28
+ var import_loaders = require("../loaders.js");
17
29
  const DEFAULTS = {
18
- logger: DEFAULT_LOGGER,
19
- maxAttempts: DEFAULT_MAX_ATTEMPTS,
20
- maxRuntime: DEFAULT_MAX_RUNTIME,
21
- deleteFailedJobs: DEFAULT_DELETE_FAILED_JOBS,
22
- deleteSuccessfulJobs: DEFAULT_DELETE_SUCCESSFUL_JOBS
30
+ logger: import_consts.DEFAULT_LOGGER,
31
+ maxAttempts: import_consts.DEFAULT_MAX_ATTEMPTS,
32
+ deleteFailedJobs: import_consts.DEFAULT_DELETE_FAILED_JOBS,
33
+ deleteSuccessfulJobs: import_consts.DEFAULT_DELETE_SUCCESSFUL_JOBS
23
34
  };
24
35
  class Executor {
25
36
  options;
@@ -27,22 +38,20 @@ class Executor {
27
38
  logger;
28
39
  job;
29
40
  maxAttempts;
30
- maxRuntime;
31
41
  deleteFailedJobs;
32
42
  deleteSuccessfulJobs;
33
43
  constructor(options) {
34
44
  this.options = { ...DEFAULTS, ...options };
35
45
  if (!this.options.adapter) {
36
- throw new AdapterRequiredError();
46
+ throw new import_errors.AdapterRequiredError();
37
47
  }
38
48
  if (!this.options.job) {
39
- throw new JobRequiredError();
49
+ throw new import_errors.JobRequiredError();
40
50
  }
41
51
  this.adapter = this.options.adapter;
42
52
  this.logger = this.options.logger;
43
53
  this.job = this.options.job;
44
54
  this.maxAttempts = this.options.maxAttempts;
45
- this.maxRuntime = this.options.maxRuntime || DEFAULT_MAX_RUNTIME;
46
55
  this.deleteFailedJobs = this.options.deleteFailedJobs;
47
56
  this.deleteSuccessfulJobs = this.options.deleteSuccessfulJobs;
48
57
  }
@@ -51,78 +60,42 @@ class Executor {
51
60
  }
52
61
  async perform() {
53
62
  this.logger.info(`[CedarJS Jobs] Started job ${this.jobIdentifier}`);
54
- const abortController = new AbortController();
55
- let timeoutId;
56
- let performPromise;
57
63
  try {
58
- const timeoutPromise = new Promise((_resolve, reject) => {
59
- timeoutId = setTimeout(() => {
60
- reject(new JobTimeoutError(this.jobIdentifier, this.maxRuntime));
61
- }, this.maxRuntime * 1e3);
62
- });
63
- performPromise = (async () => {
64
- const job = await loadJob({ name: this.job.name, path: this.job.path });
65
- await executionContext.run(
66
- { signal: abortController.signal, job: this.job },
67
- () => job.perform(...this.job.args)
68
- );
69
- })();
70
- await Promise.race([performPromise, timeoutPromise]);
71
- const runAt = this.job.cron ? CronExpressionParser.parse(this.job.cron).next().toDate() : void 0;
64
+ const job = await (0, import_loaders.loadJob)({ name: this.job.name, path: this.job.path });
65
+ await job.perform(...this.job.args);
66
+ const runAt = this.job.cron ? import_cron_parser.CronExpressionParser.parse(this.job.cron).next().toDate() : void 0;
72
67
  await this.adapter.success({
73
68
  job: this.job,
74
69
  runAt,
75
70
  deleteJob: !runAt && this.deleteSuccessfulJobs
76
71
  });
77
- } catch (rawError) {
78
- const error = rawError instanceof Error ? rawError : new Error(String(rawError));
79
- const timedOut = error instanceof JobTimeoutError;
80
- if (timedOut) {
81
- abortController.abort(error);
82
- performPromise?.catch(() => {
83
- });
84
- }
72
+ } catch (error) {
85
73
  const errorMessage = `[CedarJS Jobs] Error in job ${this.jobIdentifier}: ${error.message}`;
86
74
  this.logger.error(errorMessage);
87
75
  this.logger.error(error.stack);
88
- if (timedOut) {
89
- this.logger.warn(
90
- this.job,
91
- `[CedarJS Jobs] Failed job ${this.jobIdentifier}: exceeded max runtime (${this.maxRuntime} seconds)`
92
- );
76
+ await this.adapter.error({
77
+ job: this.job,
78
+ runAt: new Date(
79
+ (/* @__PURE__ */ new Date()).getTime() + this.backoffMilliseconds(this.job.attempts)
80
+ ),
81
+ error
82
+ });
83
+ if (this.job.attempts >= this.maxAttempts) {
84
+ const maxAttemptsMessage = `[CedarJS Jobs] Failed job ${this.jobIdentifier}: reached max attempts (${this.maxAttempts})`;
85
+ this.logger.warn(this.job, maxAttemptsMessage);
93
86
  await this.adapter.failure({
94
87
  job: this.job,
95
- deleteJob: this.deleteFailedJobs,
96
- error
88
+ deleteJob: this.deleteFailedJobs
97
89
  });
98
- } else {
99
- await this.adapter.error({
100
- job: this.job,
101
- runAt: new Date(
102
- (/* @__PURE__ */ new Date()).getTime() + this.backoffMilliseconds(this.job.attempts)
103
- ),
104
- error
105
- });
106
- if (this.job.attempts >= this.maxAttempts) {
107
- this.logger.warn(
108
- this.job,
109
- `[CedarJS Jobs] Failed job ${this.jobIdentifier}: reached max attempts (${this.maxAttempts})`
110
- );
111
- await this.adapter.failure({
112
- job: this.job,
113
- deleteJob: this.deleteFailedJobs
114
- });
115
- }
116
90
  }
117
- } finally {
118
- clearTimeout(timeoutId);
119
91
  }
120
92
  }
121
93
  backoffMilliseconds(attempts) {
122
94
  return 1e3 * attempts ** 4;
123
95
  }
124
96
  }
125
- export {
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
126
99
  DEFAULTS,
127
100
  Executor
128
- };
101
+ });
@@ -13,9 +13,7 @@ export declare class JobManager<TAdapters extends Adapters, TQueues extends Queu
13
13
  logger: TLogger;
14
14
  workers: WorkerConfig<TAdapters, TQueues>[];
15
15
  constructor(config: JobManagerConfig<TAdapters, TQueues extends string[] ? never : TQueues, TLogger>);
16
- createScheduler<TAdapterName extends keyof TAdapters>(schedulerConfig: CreateSchedulerConfig<TAdapters, TAdapterName>): (<TJob extends Job<TQueues, any[]>>(job: TJob, ...argsAndOptions: CreateSchedulerArgs<TJob>) => Promise<void>) & {
17
- cancel: (jobId: string | number) => Promise<boolean>;
18
- };
16
+ createScheduler(schedulerConfig: CreateSchedulerConfig<TAdapters>): <TJob extends Job<TQueues, any[]>>(job: TJob, ...argsAndOptions: CreateSchedulerArgs<TJob>) => Promise<boolean>;
19
17
  createJob<TArgs extends unknown[]>(jobDefinition: JobDefinition<TQueues, TArgs>): Job<TQueues, TArgs>;
20
18
  createWorker({ index, workoff, clear, processName }: CreateWorkerArgs): Worker;
21
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"JobManager.d.ts","sourceRoot":"","sources":["../../src/core/JobManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,YAAY,EACb,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;IACjC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,UAAU,CACrB,SAAS,SAAS,QAAQ,EAC1B,OAAO,SAAS,UAAU,EAC1B,OAAO,SAAS,WAAW;IAE3B,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAA;gBAGzC,MAAM,EAAE,gBAAgB,CACtB,SAAS,EAGT,OAA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O,CAAA;IACf,OAAO,EAAE,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAA;gBAGzC,MAAM,EAAE,gBAAgB,CACtB,SAAS,EAGT,OAAO,SAAS,MAAM,EAAE,GAAG,KAAK,GAAG,OAAO,EAC1C,OAAO,CACR;IAQH,eAAe,CAAC,eAAe,EAAE,qBAAqB,CAAC,SAAS,CAAC,IAMvD,IAAI,SAAS,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,EACtC,KAAK,IAAI,EACT,GAAG,gBAAgB,mBAAmB,CAAC,IAAI,CAAC;IAYhD,SAAS,CAAC,KAAK,SAAS,OAAO,EAAE,EAC/B,aAAa,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,GAC3C,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;IAOtB,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,gBAAgB;CAqBtE"}
@@ -1,6 +1,29 @@
1
- import { AdapterNotFoundError } from "../errors.js";
2
- import { Scheduler } from "./Scheduler.js";
3
- import { Worker } from "./Worker.js";
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var JobManager_exports = {};
20
+ __export(JobManager_exports, {
21
+ JobManager: () => JobManager
22
+ });
23
+ module.exports = __toCommonJS(JobManager_exports);
24
+ var import_errors = require("../errors.js");
25
+ var import_Scheduler = require("./Scheduler.js");
26
+ var import_Worker = require("./Worker.js");
4
27
  class JobManager {
5
28
  adapters;
6
29
  queues;
@@ -13,20 +36,17 @@ class JobManager {
13
36
  this.workers = config.workers;
14
37
  }
15
38
  createScheduler(schedulerConfig) {
16
- const scheduler = new Scheduler({
39
+ const scheduler = new import_Scheduler.Scheduler({
17
40
  adapter: this.adapters[schedulerConfig.adapter],
18
41
  logger: schedulerConfig.logger ?? this.logger
19
42
  });
20
- const schedule = (job, ...argsAndOptions) => {
43
+ return (job, ...argsAndOptions) => {
21
44
  const [possibleArgs, possibleOptions] = argsAndOptions;
22
45
  const didPassArgs = Array.isArray(possibleArgs);
23
46
  const args = didPassArgs ? possibleArgs : [];
24
47
  const options = didPassArgs ? possibleOptions : possibleArgs;
25
48
  return scheduler.schedule({ job, args, options });
26
49
  };
27
- return Object.assign(schedule, {
28
- cancel: (jobId) => scheduler.cancel(jobId)
29
- });
30
50
  }
31
51
  createJob(jobDefinition) {
32
52
  return jobDefinition;
@@ -35,9 +55,9 @@ class JobManager {
35
55
  const config = this.workers[index];
36
56
  const adapter = this.adapters[config.adapter];
37
57
  if (!adapter) {
38
- throw new AdapterNotFoundError(config.adapter.toString());
58
+ throw new import_errors.AdapterNotFoundError(config.adapter.toString());
39
59
  }
40
- return new Worker({
60
+ return new import_Worker.Worker({
41
61
  adapter: this.adapters[config.adapter],
42
62
  logger: config.logger || this.logger,
43
63
  maxAttempts: config.maxAttempts,
@@ -52,6 +72,7 @@ class JobManager {
52
72
  });
53
73
  }
54
74
  }
55
- export {
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
56
77
  JobManager
57
- };
78
+ });
@@ -21,17 +21,7 @@ export declare class Scheduler<TAdapter extends BaseAdapter> {
21
21
  job: TJob;
22
22
  args: Parameters<TJob['perform']> | never[];
23
23
  options?: ScheduleJobOptions;
24
- }): Promise<void>;
25
- /**
26
- * Cancel a scheduled job so that it will not be run (if it's still queued)
27
- * or not be retried (if it's currently running). Requires an adapter that
28
- * implements the optional `cancel()` method, like the `PrismaAdapter`.
29
- *
30
- * Returns whatever the adapter's `cancel()` returns (for the
31
- * `PrismaAdapter` that's `true` if a job was cancelled and `false` if no
32
- * cancellable job with the given id was found)
33
- */
34
- cancel(jobId: string | number): Promise<boolean>;
24
+ }): Promise<boolean>;
35
25
  }
36
26
  export {};
37
27
  //# sourceMappingURL=Scheduler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../../src/core/Scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAChB,MAAM,wCAAwC,CAAA;AAa/C,OAAO,KAAK,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,kBAAkB,EACnB,MAAM,aAAa,CAAA;AAEpB,UAAU,eAAe,CAAC,QAAQ,SAAS,WAAW;IACpD,OAAO,EAAE,QAAQ,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,qBAAa,SAAS,CAAC,QAAQ,SAAS,WAAW;IACjD,OAAO,EAAE,QAAQ,CAAA;IACjB,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAE5C,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC;IAS1D,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE;IAU1E,YAAY,CAAC,IAAI,SAAS,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,EACpD,GAAG,EACH,IAAI,EACJ,OAAO,GACR,EAAE;QACD,GAA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