@domain.js/main 0.1.8 → 0.1.9
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/.husky/pre-commit
CHANGED
|
@@ -16,7 +16,7 @@ interface callbackArg {
|
|
|
16
16
|
interface Deps {
|
|
17
17
|
cronParser: typeof cronParser;
|
|
18
18
|
humanInterval: typeof human;
|
|
19
|
-
|
|
19
|
+
myCia: {
|
|
20
20
|
regist: (name: string, validator: any, waiters: waiter[]) => void;
|
|
21
21
|
submit: (name: string, times: number, callback: (arg: callbackArg) => void) => void;
|
|
22
22
|
};
|
package/dist/deps/cron/index.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Deps = exports.Main = void 0;
|
|
|
4
4
|
function Main(cnf, deps) {
|
|
5
5
|
const { cron = {} } = cnf;
|
|
6
6
|
const ciaTaskType = "cronJob";
|
|
7
|
-
const {
|
|
7
|
+
const { myCia, humanInterval: human, cronParser: parser } = deps;
|
|
8
8
|
const { tz = "Asia/Shanghai" } = cron;
|
|
9
9
|
// 注册信息
|
|
10
10
|
const registed = {};
|
|
@@ -40,7 +40,7 @@ function Main(cnf, deps) {
|
|
|
40
40
|
setTimeout(() => {
|
|
41
41
|
opt.times += 1;
|
|
42
42
|
opt.triggeredAt = Date.now();
|
|
43
|
-
|
|
43
|
+
myCia.submit(`Cron::${name}`, opt.times, ({ cronJob: [err, , totalMS] }) => {
|
|
44
44
|
if (err) {
|
|
45
45
|
opt.failds += 1;
|
|
46
46
|
}
|
|
@@ -72,7 +72,7 @@ function Main(cnf, deps) {
|
|
|
72
72
|
};
|
|
73
73
|
// 注册到cia上, 为了借助cia的能力自动下发任务
|
|
74
74
|
// 增加 Cron:: 前缀是为了避免和其他任务名称冲突
|
|
75
|
-
|
|
75
|
+
myCia.regist(`Cron::${name}`, null, [{ type: ciaTaskType }]);
|
|
76
76
|
};
|
|
77
77
|
const start = () => {
|
|
78
78
|
if (startedAt)
|