From afc1869b6119d67687cc402a6eb140276b87bc12 Mon Sep 17 00:00:00 2001 From: Xc Date: Sun, 8 Jan 2023 21:15:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=86node-schedule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/debugStore/index.js | 4 ++-- package.json | 2 -- src/debugStore/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/debugStore/index.js b/lib/debugStore/index.js index a13a40b0..da2571e7 100644 --- a/lib/debugStore/index.js +++ b/lib/debugStore/index.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.createDebugStore = exports.clearMaterializedData = void 0; var tslib_1 = require("tslib"); -var node_schedule_1 = require("node-schedule"); +var cron_1 = require("oak-domain/lib/utils/cron"); var constant_1 = require("../constant/constant"); var DebugStore_1 = require("./DebugStore"); var actionDef_1 = require("oak-domain/lib/store/actionDef"); @@ -267,7 +267,7 @@ function initializeTimers(store, contextBuilder, timers) { var _this = this; var _loop_1 = function (timer) { var cron = timer.cron, fn = timer.fn, name_1 = timer.name; - (0, node_schedule_1.scheduleJob)(name_1, cron, function (date) { return tslib_1.__awaiter(_this, void 0, void 0, function () { + (0, cron_1.schedule)(cron, function (date) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var start, context, result, err_2; return tslib_1.__generator(this, function (_a) { switch (_a.label) { diff --git a/package.json b/package.json index 00680cfe..5e2e2867 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "@types/luxon": "^2.0.9", "@types/mocha": "^8.2.0", "@types/node": "^14.14.25", - "@types/node-schedule": "^2.1.0", "@types/react": "^18.0.12", "@types/react-dom": "^18.0.5", "@types/uuid": "^8.3.0", @@ -56,7 +55,6 @@ "cross-env": "^7.0.2", "fs-extra": "^10.0.0", "mocha": "^8.2.1", - "node-schedule": "^2.1.0", "rimraf": "^3.0.2", "ts-node": "~10.9.1", "tslib": "^2.4.0", diff --git a/src/debugStore/index.ts b/src/debugStore/index.ts index fcbe9929..96a5b125 100644 --- a/src/debugStore/index.ts +++ b/src/debugStore/index.ts @@ -1,4 +1,4 @@ -import { scheduleJob } from 'node-schedule'; +import { schedule } from 'oak-domain/lib/utils/cron'; import { LOCAL_STORAGE_KEYS } from '../constant/constant'; import { DebugStore } from './DebugStore'; import { @@ -196,7 +196,7 @@ function initializeTimers { + schedule(cron, async (date) => { const start = Date.now(); const context = await contextBuilder()(store); await context.begin();