@ruiapp/rapid-core 0.3.3 → 0.3.4
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/dist/index.js
CHANGED
|
@@ -7853,6 +7853,7 @@ class CronJobPlugin {
|
|
|
7853
7853
|
async onApplicationReady(server, applicationConfig) {
|
|
7854
7854
|
for (const job of this.#jobs) {
|
|
7855
7855
|
const jobInstance = cron__namespace.CronJob.from({
|
|
7856
|
+
...(job.jobOptions || {}),
|
|
7856
7857
|
cronTime: job.cronTime,
|
|
7857
7858
|
onTick: async () => {
|
|
7858
7859
|
server.getLogger().info(`Executing cron job '${job.code}'...`);
|
|
@@ -12,6 +12,10 @@ export interface CronJobConfiguration {
|
|
|
12
12
|
* crontab 表达式
|
|
13
13
|
*/
|
|
14
14
|
cronTime: string;
|
|
15
|
+
/**
|
|
16
|
+
* 任务设置
|
|
17
|
+
*/
|
|
18
|
+
jobOptions?: CronJobOptions;
|
|
15
19
|
/**
|
|
16
20
|
* 任务处理程序编号。当指定处理程序编号时,忽略 handler 配置。
|
|
17
21
|
*/
|
|
@@ -28,6 +32,16 @@ export interface CronJobConfiguration {
|
|
|
28
32
|
*/
|
|
29
33
|
handleOptions?: any;
|
|
30
34
|
}
|
|
35
|
+
export interface CronJobOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Instantly triggers the onTick function post initialization. Default is false.
|
|
38
|
+
*/
|
|
39
|
+
runOnInit?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If true, no additional instances of the onTick callback function will run until the current onTick callback has completed. Any new scheduled executions that occur while the current callback is running will be skipped entirely. Default is false.
|
|
42
|
+
*/
|
|
43
|
+
waitForCompletion?: boolean;
|
|
44
|
+
}
|
|
31
45
|
export interface CronJobPluginInitOptions {
|
|
32
46
|
jobs: CronJobConfiguration[];
|
|
33
47
|
}
|
package/package.json
CHANGED
|
@@ -71,6 +71,7 @@ class CronJobPlugin implements RapidPlugin {
|
|
|
71
71
|
async onApplicationReady(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
|
|
72
72
|
for (const job of this.#jobs) {
|
|
73
73
|
const jobInstance = cron.CronJob.from({
|
|
74
|
+
...(job.jobOptions || {}),
|
|
74
75
|
cronTime: job.cronTime,
|
|
75
76
|
onTick: async () => {
|
|
76
77
|
server.getLogger().info(`Executing cron job '${job.code}'...`);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ActionHandlerContext } from "~/core/actionHandler";
|
|
2
|
-
import { RpdHttpMethod } from "~/types";
|
|
3
2
|
|
|
4
3
|
export interface CronJobConfiguration {
|
|
5
4
|
/**
|
|
@@ -17,6 +16,11 @@ export interface CronJobConfiguration {
|
|
|
17
16
|
*/
|
|
18
17
|
cronTime: string;
|
|
19
18
|
|
|
19
|
+
/**
|
|
20
|
+
* 任务设置
|
|
21
|
+
*/
|
|
22
|
+
jobOptions?: CronJobOptions;
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* 任务处理程序编号。当指定处理程序编号时,忽略 handler 配置。
|
|
22
26
|
*/
|
|
@@ -36,6 +40,18 @@ export interface CronJobConfiguration {
|
|
|
36
40
|
handleOptions?: any;
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
export interface CronJobOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Instantly triggers the onTick function post initialization. Default is false.
|
|
46
|
+
*/
|
|
47
|
+
runOnInit?: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* If true, no additional instances of the onTick callback function will run until the current onTick callback has completed. Any new scheduled executions that occur while the current callback is running will be skipped entirely. Default is false.
|
|
51
|
+
*/
|
|
52
|
+
waitForCompletion?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
export interface CronJobPluginInitOptions {
|
|
40
56
|
jobs: CronJobConfiguration[];
|
|
41
57
|
}
|