Compare commits

..

4 Commits

Author SHA1 Message Date
ddc9a77fe2 2.1.5 2020-09-02 13:04:12 +00:00
575912eab7 fix(core): update 2020-09-02 13:04:12 +00:00
eee146ae8b 2.1.4 2020-07-12 10:57:15 +00:00
ea8ef61c40 fix(core): update 2020-07-12 10:57:15 +00:00
6 changed files with 2580 additions and 1503 deletions

4038
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/taskbuffer",
"version": "2.1.3",
"version": "2.1.5",
"private": false,
"description": "flexible task management. TypeScript ready!",
"main": "dist_ts/index.js",
@ -27,21 +27,21 @@
},
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
"dependencies": {
"@pushrocks/lik": "^4.0.14",
"@pushrocks/lik": "^4.0.17",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartlog": "^2.0.35",
"@pushrocks/smartlog": "^2.0.36",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.18",
"@pushrocks/smarttime": "^3.0.24",
"@types/cron": "^1.7.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.72",
"@gitzone/tstest": "^1.0.43",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.0.22",
"tslint": "^6.1.2",
"@types/node": "^14.6.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"files": [

View File

@ -28,6 +28,7 @@ tap.test('should run the task as expected', async () => {
},
})
);
myTaskManager.start();
await myTaskManager.triggerTaskByName('myTask');
// tslint:disable-next-line:no-unused-expression
expect(referenceBoolean).to.be.true;
@ -39,4 +40,8 @@ tap.test('should schedule task', async () => {
myTaskManager.descheduleTaskByName('myTask');
});
tap.test('should stop the taskmanager', async () => {
myTaskManager.stop();
});
tap.start();

View File

@ -28,6 +28,7 @@ tap.test('should run the task as expected', async () => {
},
})
);
myTaskManager.start();
await myTaskManager.triggerTaskByName('myTask');
// tslint:disable-next-line:no-unused-expression
expect(referenceBoolean).to.be.true;
@ -39,4 +40,8 @@ tap.test('should schedule task', async () => {
myTaskManager.descheduleTaskByName('myTask');
});
tap.test('should stop the taskmanager', async () => {
myTaskManager.stop();
});
tap.start();

View File

@ -9,7 +9,7 @@ export class TaskDebounced<T = unknown> extends Task {
constructor(optionsArg: {
name: string;
taskFunction: ITaskFunction;
type: 'atMostEvery' | 'afterQuietFor'
debounceTimeInMillis: number;
}) {
super({
name: optionsArg.name,
@ -18,7 +18,7 @@ export class TaskDebounced<T = unknown> extends Task {
}
});
this.taskFunction = optionsArg.taskFunction;
this._observableIntake.observable.pipe(plugins.smartrx.rxjs.ops.debounceTime(2000)).subscribe((x) => {
this._observableIntake.observable.pipe(plugins.smartrx.rxjs.ops.debounceTime(optionsArg.debounceTimeInMillis)).subscribe((x) => {
this.taskFunction(x);
});
}

View File

@ -74,7 +74,6 @@ export class TaskManager {
await taskToSchedule.triggerBuffered();
});
taskToSchedule.cronJob = cronJob;
this.cronJobManager.start();
}
/**
@ -104,4 +103,18 @@ export class TaskManager {
* @param taskNameArg
*/
public getSchedulesForTaskName(taskNameArg: string) {}
/**
* starts the taskmanager
*/
public start() {
this.cronJobManager.start();
}
/**
* stops the taskmanager
*/
public stop() {
this.cronJobManager.stop();
}
}