去掉了node-schedule

This commit is contained in:
Xu Chang 2023-01-08 21:15:21 +08:00
parent 813dfcbb67
commit afc1869b61
3 changed files with 4 additions and 6 deletions

View File

@ -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) {

View File

@ -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",

View File

@ -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<ED extends EntityDict & BaseEntityDict, Cxt extends As
) {
for (const timer of timers) {
const { cron, fn, name } = timer;
scheduleJob(name, cron, async (date) => {
schedule(cron, async (date) => {
const start = Date.now();
const context = await contextBuilder()(store);
await context.begin();