@clairejs/server 3.27.2 → 3.27.3
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/README.md +1 -1
- package/dist/job/AbstractJobScheduler.d.ts +0 -5
- package/dist/job/AbstractJobScheduler.js +0 -2
- package/dist/job/AwsJobScheduler.d.ts +0 -1
- package/dist/job/AwsJobScheduler.js +2 -6
- package/dist/job/LocalJobScheduler.d.ts +0 -1
- package/dist/job/LocalJobScheduler.js +0 -3
- package/dist/system/lamba-request-mapper.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,11 +29,6 @@ export declare abstract class AbstractJobScheduler {
|
|
|
29
29
|
* @param id The job id returned from scheduleJobAt function
|
|
30
30
|
*/
|
|
31
31
|
protected abstract cancelJob(id: string): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Clean up the job after it has been executed
|
|
34
|
-
* @param job The job to clean up
|
|
35
|
-
*/
|
|
36
|
-
protected abstract cleanupJob(job: AbstractJob): Promise<void>;
|
|
37
32
|
/**
|
|
38
33
|
* Remove the scheduled job and prevent if from running in the future
|
|
39
34
|
* @param id The job id returned from scheduleJobAt function
|
|
@@ -129,8 +129,6 @@ export class AbstractJobScheduler {
|
|
|
129
129
|
await jobHandler.handlerFn(job);
|
|
130
130
|
//-- job run success, update
|
|
131
131
|
update.lastSuccessAt = Date.now();
|
|
132
|
-
//-- clean up
|
|
133
|
-
await this.cleanupJob(job);
|
|
134
132
|
//-- reset retry count if this is cron job
|
|
135
133
|
if (job.cron) {
|
|
136
134
|
if (job.retryCount) {
|
|
@@ -15,7 +15,6 @@ export declare class AwsJobScheduler extends AbstractJobScheduler {
|
|
|
15
15
|
constructor(logger: AbstractLogger, db: AbstractDbAdapter, jobRepo: AbstractJobRepository, apiLambdaFunctionArn: string, apiLambdaFunctionRoleArn: string, jobNamespace: string);
|
|
16
16
|
handleCron(jobInfo: AbstractJob): Promise<void>;
|
|
17
17
|
private convertCronToSchedulerExpression;
|
|
18
|
-
protected cleanupJob(job: AbstractJob): Promise<void>;
|
|
19
18
|
protected getScheduledJobs(): Promise<AbstractJob[]>;
|
|
20
19
|
protected _scheduleJob(jobInfo: AbstractJob): Promise<void>;
|
|
21
20
|
cancelJob(jobId: string): Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { AbstractLogger, Errors, LogContext } from "@clairejs/core";
|
|
11
11
|
import { AbstractDbAdapter } from "@clairejs/orm";
|
|
12
|
-
import { SchedulerClient, CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, ListSchedulesCommand, ScheduleState } from "@aws-sdk/client-scheduler";
|
|
12
|
+
import { SchedulerClient, CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, ListSchedulesCommand, ScheduleState, ActionAfterCompletion } from "@aws-sdk/client-scheduler";
|
|
13
13
|
import { AbstractJobScheduler } from "./AbstractJobScheduler";
|
|
14
14
|
import { AbstractJobRepository } from "./AbstractJobRepository";
|
|
15
15
|
/**
|
|
@@ -56,11 +56,6 @@ let AwsJobScheduler = class AwsJobScheduler extends AbstractJobScheduler {
|
|
|
56
56
|
}
|
|
57
57
|
return parts.join(" ");
|
|
58
58
|
}
|
|
59
|
-
async cleanupJob(job) {
|
|
60
|
-
if (job.at) {
|
|
61
|
-
await this.cancelJob(job.id);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
59
|
async getScheduledJobs() {
|
|
65
60
|
try {
|
|
66
61
|
const listCommand = new ListSchedulesCommand({
|
|
@@ -141,6 +136,7 @@ let AwsJobScheduler = class AwsJobScheduler extends AbstractJobScheduler {
|
|
|
141
136
|
}),
|
|
142
137
|
},
|
|
143
138
|
State: ScheduleState.ENABLED,
|
|
139
|
+
ActionAfterCompletion: ActionAfterCompletion.DELETE,
|
|
144
140
|
};
|
|
145
141
|
try {
|
|
146
142
|
const createCommand = new CreateScheduleCommand(scheduleParams);
|
|
@@ -50,7 +50,6 @@ export declare class LocalJobScheduler extends AbstractJobScheduler implements I
|
|
|
50
50
|
private sendJob;
|
|
51
51
|
private processMessage;
|
|
52
52
|
private extendMutexKey;
|
|
53
|
-
protected cleanupJob(): Promise<void>;
|
|
54
53
|
init(): Promise<void>;
|
|
55
54
|
exit(): void;
|
|
56
55
|
protected getScheduledJobs(): Promise<AbstractJob[]>;
|
|
@@ -103,9 +103,6 @@ let LocalJobScheduler = class LocalJobScheduler extends AbstractJobScheduler {
|
|
|
103
103
|
await this.redisClient.setex(this.holdMutexKey, this.keyRetentionDurationSeconds, 1);
|
|
104
104
|
this.logger.debug("Scheduler extends mutex key");
|
|
105
105
|
}
|
|
106
|
-
async cleanupJob() {
|
|
107
|
-
//-- do nothing
|
|
108
|
-
}
|
|
109
106
|
async init() {
|
|
110
107
|
this.logger.debug("LocalJobScheduler init");
|
|
111
108
|
//-- subscribe to multi client channel
|
|
@@ -11,7 +11,6 @@ const parseCookie = (cookieArray) => {
|
|
|
11
11
|
return result;
|
|
12
12
|
};
|
|
13
13
|
export const lambdaRequestMapper = (event) => {
|
|
14
|
-
console.log("lambda event", event);
|
|
15
14
|
if (event.requestContext.eventType) {
|
|
16
15
|
//-- socket
|
|
17
16
|
const method = event.requestContext.eventType.toLowerCase();
|