@spinajs/tasks 2.0.553 → 2.0.555
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/lib/cjs/decorators.d.ts +41 -11
- package/lib/cjs/decorators.d.ts.map +1 -1
- package/lib/cjs/decorators.js +172 -76
- package/lib/cjs/decorators.js.map +1 -1
- package/lib/mjs/decorators.d.ts +41 -11
- package/lib/mjs/decorators.d.ts.map +1 -1
- package/lib/mjs/decorators.js +170 -76
- package/lib/mjs/decorators.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +7 -6
package/lib/mjs/decorators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mutex_acquire, mutex_release } from '@spinajs/threading';
|
|
1
|
+
import { mutex_acquire, mutex_release, mutex_renew } from '@spinajs/threading';
|
|
2
2
|
import { _check_arg, _non_empty, _trim } from '@spinajs/util';
|
|
3
3
|
import { DI } from '@spinajs/di';
|
|
4
4
|
import { __task } from './models/__task.js';
|
|
@@ -7,87 +7,181 @@ import { __task_history } from './models/__task_history.js';
|
|
|
7
7
|
import { TaskSuccess } from './events/TaskSuccess.js';
|
|
8
8
|
import { TaskFailed } from './events/TaskFailed.js';
|
|
9
9
|
export const TASK_COMMAND = 'task:command';
|
|
10
|
+
export const DEFAULT_TASK_OPTIONS = {
|
|
11
|
+
taskStacking: false,
|
|
12
|
+
lockTtl: 60000,
|
|
13
|
+
};
|
|
14
|
+
// The mutex is re-entrant per tenant and the default tenant is per process,
|
|
15
|
+
// so overlapping runs inside one process are excluded here, not by the mutex.
|
|
16
|
+
const runningInProcess = new Set();
|
|
17
|
+
async function lockTask(name, opts, log) {
|
|
18
|
+
if (opts.taskStacking) {
|
|
19
|
+
return async () => { };
|
|
20
|
+
}
|
|
21
|
+
if (runningInProcess.has(name)) {
|
|
22
|
+
log.warn(`Task ${name} is already running in this process`);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
runningInProcess.add(name);
|
|
26
|
+
const mutexName = `task-${name}`;
|
|
27
|
+
try {
|
|
28
|
+
const lock = await mutex_acquire({ Name: mutexName, ttl: opts.lockTtl });
|
|
29
|
+
if (!lock.Locked) {
|
|
30
|
+
runningInProcess.delete(name);
|
|
31
|
+
log.warn(`Cannot acquire mutex for task ${name}, already locked !`);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
runningInProcess.delete(name);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
const heartbeat = opts.lockTtl > 0
|
|
40
|
+
? setInterval(() => {
|
|
41
|
+
mutex_renew({ Name: mutexName, ttl: opts.lockTtl })
|
|
42
|
+
.then((renewed) => {
|
|
43
|
+
if (!renewed) {
|
|
44
|
+
log.warn(`Task ${name} lost its mutex, another process may run it now`);
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.catch((err) => log.error(err, `Cannot renew mutex for task ${name}`));
|
|
48
|
+
}, Math.max(1, Math.floor(opts.lockTtl / 3)))
|
|
49
|
+
: undefined;
|
|
50
|
+
return async () => {
|
|
51
|
+
clearInterval(heartbeat);
|
|
52
|
+
runningInProcess.delete(name);
|
|
53
|
+
await mutex_release({ Name: mutexName });
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const declarations = new Map();
|
|
57
|
+
export function getTaskDeclarations(name) {
|
|
58
|
+
if (name !== undefined) {
|
|
59
|
+
return [...(declarations.get(name) ?? [])];
|
|
60
|
+
}
|
|
61
|
+
return [...declarations.values()].flat();
|
|
62
|
+
}
|
|
63
|
+
function errorMessage(err) {
|
|
64
|
+
return err?.message ?? String(err);
|
|
65
|
+
}
|
|
66
|
+
const NO_LOCK = () => Promise.resolve();
|
|
10
67
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
68
|
+
* Runs a task method with the `@Task` bookkeeping: `__tasks` state, a `__task_history` row and
|
|
69
|
+
* TaskSuccess / TaskFailed. The decorator calls it with `{ lock: true, rethrow: false }`.
|
|
70
|
+
*/
|
|
71
|
+
export async function runTask(decl, thisArg, args, opts) {
|
|
72
|
+
const log = DI.resolve('__log__', ['TASKS']);
|
|
73
|
+
log.info(`Executing task ${decl.name} ...`);
|
|
74
|
+
let task;
|
|
75
|
+
let unlock;
|
|
76
|
+
try {
|
|
77
|
+
task = await __task.getOrCreate(null, {
|
|
78
|
+
Name: decl.name,
|
|
79
|
+
Description: decl.description,
|
|
80
|
+
State: 'stopped',
|
|
81
|
+
});
|
|
82
|
+
const lock = opts.lock ? await lockTask(decl.name, decl.options, log) : NO_LOCK;
|
|
83
|
+
if (!lock) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
unlock = lock;
|
|
87
|
+
try {
|
|
88
|
+
task.State = 'running';
|
|
89
|
+
task.LastRunAt = DateTime.now();
|
|
90
|
+
await task.update();
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
await unlock();
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
log.error(err, `Cannot start task ${decl.name}`);
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
let taskResult = null;
|
|
102
|
+
let failure = null;
|
|
103
|
+
const start = DateTime.now();
|
|
104
|
+
try {
|
|
105
|
+
try {
|
|
106
|
+
taskResult = await decl.method.apply(thisArg, args);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
failure = { error: err };
|
|
110
|
+
log.error(err, `Cannot execute task ${decl.name}`);
|
|
111
|
+
taskResult = {
|
|
112
|
+
error: true,
|
|
113
|
+
message: errorMessage(err),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// An emit failure (queue outage) is logged only: it must not turn a run whose side effects
|
|
117
|
+
// already happened into a failure that a caller would retry.
|
|
118
|
+
try {
|
|
119
|
+
if (failure) {
|
|
120
|
+
await TaskFailed.emit({
|
|
121
|
+
TaskName: decl.name,
|
|
122
|
+
Reason: errorMessage(failure.error),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
await TaskSuccess.emit({
|
|
127
|
+
TaskName: decl.name,
|
|
128
|
+
});
|
|
129
|
+
log.success(`Task ${decl.name} executed !`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (emitErr) {
|
|
133
|
+
log.error(emitErr, `Cannot emit ${failure ? 'TaskFailed' : 'TaskSuccess'} for ${decl.name}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
try {
|
|
138
|
+
await unlock();
|
|
139
|
+
await task.update({
|
|
140
|
+
State: 'stopped',
|
|
141
|
+
});
|
|
142
|
+
await __task_history.insert({
|
|
143
|
+
TaskId: task.Id,
|
|
144
|
+
Result: taskResult,
|
|
145
|
+
Duration: DateTime.now().diff(start).milliseconds,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
log.error(err, `Cannot finalize task`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (failure && opts.rethrow) {
|
|
153
|
+
throw failure.error;
|
|
154
|
+
}
|
|
155
|
+
return taskResult;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Marks a method as a task: records runs in `__tasks` / `__task_history`, emits
|
|
159
|
+
* TaskSuccess / TaskFailed and, unless `taskStacking` is set, lets only one run
|
|
160
|
+
* happen at a time across all processes sharing the database. The declaration is
|
|
161
|
+
* also recorded, so `@spinajs/scheduler` can schedule the method by task name.
|
|
16
162
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param description
|
|
19
|
-
* @param opts -
|
|
163
|
+
* @param taskName - unique task name
|
|
164
|
+
* @param description - short description
|
|
165
|
+
* @param opts - see {@link TaskOptions}, defaults to {@link DEFAULT_TASK_OPTIONS}
|
|
20
166
|
*/
|
|
21
167
|
export function Task(taskName, description, opts) {
|
|
22
168
|
const _name = _check_arg(_trim(), _non_empty())(taskName, 'Task name is empty');
|
|
23
169
|
const _description = _check_arg(_trim(), _non_empty())(description, 'Task description is empty');
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!lock.Locked) {
|
|
40
|
-
log.warn(`Cannot acquire mutex for task ${_name}, already locked !`);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
task.State = 'running';
|
|
45
|
-
task.LastRunAt = DateTime.now();
|
|
46
|
-
await task.update();
|
|
47
|
-
let taskResult = null;
|
|
48
|
-
const start = DateTime.now();
|
|
49
|
-
try {
|
|
50
|
-
taskResult = await oldFunction.apply(this, args);
|
|
51
|
-
await TaskSuccess.emit({
|
|
52
|
-
TaskName: taskName,
|
|
53
|
-
});
|
|
54
|
-
log.success(`Task ${taskName} executed !`);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
log.error(err, `Cannot execute task ${taskName}`);
|
|
58
|
-
taskResult = {
|
|
59
|
-
error: true,
|
|
60
|
-
message: err.Message,
|
|
61
|
-
};
|
|
62
|
-
await TaskFailed.emit({
|
|
63
|
-
TaskName: taskName,
|
|
64
|
-
Reason: err.Message,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
try {
|
|
69
|
-
await mutex_release({
|
|
70
|
-
Name: `task-${name}`,
|
|
71
|
-
});
|
|
72
|
-
await task.update({
|
|
73
|
-
State: 'stopped',
|
|
74
|
-
});
|
|
75
|
-
await __task_history.insert({
|
|
76
|
-
TaskId: task.Id,
|
|
77
|
-
Result: taskResult,
|
|
78
|
-
Duration: DateTime.now().diff(start).milliseconds,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
log.error(err, `Cannot finalize task`);
|
|
83
|
-
}
|
|
84
|
-
return taskResult;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
log.error(err, `Cannot start task ${taskName}`);
|
|
89
|
-
throw err;
|
|
90
|
-
}
|
|
170
|
+
const _opts = { ...DEFAULT_TASK_OPTIONS, ...opts };
|
|
171
|
+
return function (target, propertyKey, descriptor) {
|
|
172
|
+
const isStatic = typeof target === 'function';
|
|
173
|
+
const decl = {
|
|
174
|
+
name: _name,
|
|
175
|
+
description: _description,
|
|
176
|
+
options: _opts,
|
|
177
|
+
target: isStatic ? target : target.constructor,
|
|
178
|
+
isStatic,
|
|
179
|
+
propertyKey,
|
|
180
|
+
method: descriptor.value,
|
|
181
|
+
};
|
|
182
|
+
declarations.set(_name, [...(declarations.get(_name) ?? []), decl]);
|
|
183
|
+
descriptor.value = function (...args) {
|
|
184
|
+
return runTask(decl, this, args, { lock: true, rethrow: false });
|
|
91
185
|
};
|
|
92
186
|
};
|
|
93
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5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