Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f72a88846 | |||
823d4f7d55 | |||
7d57fcf07e | |||
eb9ae2fa71 | |||
5fe60c6e50 | |||
6f811b4ab5 | |||
2cf32ac723 | |||
09936fda56 | |||
ddc9a77fe2 | |||
575912eab7 |
@ -19,23 +19,35 @@ mirror:
|
|||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
audit:
|
auditProductionDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install --production --ignore-scripts
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm audit --audit-level=high
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@ -50,9 +62,7 @@ testStable:
|
|||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
@ -63,9 +73,7 @@ testBuild:
|
|||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -85,6 +93,8 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g tslint typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4022
package-lock.json
generated
4022
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/taskbuffer",
|
"name": "@pushrocks/taskbuffer",
|
||||||
"version": "2.1.4",
|
"version": "2.1.9",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "flexible task management. TypeScript ready!",
|
"description": "flexible task management. TypeScript ready!",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -27,21 +27,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^4.0.14",
|
"@pushrocks/lik": "^4.0.17",
|
||||||
"@pushrocks/smartdelay": "^2.0.10",
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
"@pushrocks/smartlog": "^2.0.35",
|
"@pushrocks/smartlog": "^2.0.36",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@pushrocks/smartrx": "^2.0.18",
|
"@pushrocks/smartrx": "^2.0.18",
|
||||||
"@pushrocks/smarttime": "^3.0.24",
|
"@pushrocks/smarttime": "^3.0.28",
|
||||||
"@types/cron": "^1.7.2"
|
"@types/cron": "^1.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.24",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tsbundle": "^1.0.72",
|
"@gitzone/tsbundle": "^1.0.78",
|
||||||
"@gitzone/tstest": "^1.0.43",
|
"@gitzone/tstest": "^1.0.44",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^3.2.9",
|
||||||
"@types/node": "^14.0.22",
|
"@types/node": "^14.6.3",
|
||||||
"tslint": "^6.1.2",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -28,6 +28,7 @@ tap.test('should run the task as expected', async () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
myTaskManager.start();
|
||||||
await myTaskManager.triggerTaskByName('myTask');
|
await myTaskManager.triggerTaskByName('myTask');
|
||||||
// tslint:disable-next-line:no-unused-expression
|
// tslint:disable-next-line:no-unused-expression
|
||||||
expect(referenceBoolean).to.be.true;
|
expect(referenceBoolean).to.be.true;
|
||||||
@ -39,4 +40,8 @@ tap.test('should schedule task', async () => {
|
|||||||
myTaskManager.descheduleTaskByName('myTask');
|
myTaskManager.descheduleTaskByName('myTask');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should stop the taskmanager', async () => {
|
||||||
|
myTaskManager.stop();
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -28,6 +28,7 @@ tap.test('should run the task as expected', async () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
myTaskManager.start();
|
||||||
await myTaskManager.triggerTaskByName('myTask');
|
await myTaskManager.triggerTaskByName('myTask');
|
||||||
// tslint:disable-next-line:no-unused-expression
|
// tslint:disable-next-line:no-unused-expression
|
||||||
expect(referenceBoolean).to.be.true;
|
expect(referenceBoolean).to.be.true;
|
||||||
@ -39,4 +40,8 @@ tap.test('should schedule task', async () => {
|
|||||||
myTaskManager.descheduleTaskByName('myTask');
|
myTaskManager.descheduleTaskByName('myTask');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should stop the taskmanager', async () => {
|
||||||
|
myTaskManager.stop();
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -200,6 +200,7 @@ export class Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* trigger task unbuffered.
|
* trigger task unbuffered.
|
||||||
|
* will actually run the task, not considering any buffered limits.
|
||||||
*/
|
*/
|
||||||
public triggerUnBuffered(x?): Promise<any> {
|
public triggerUnBuffered(x?): Promise<any> {
|
||||||
return Task.runTask(this, { x: x });
|
return Task.runTask(this, { x: x });
|
||||||
@ -207,6 +208,7 @@ export class Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* trigger task buffered.
|
* trigger task buffered.
|
||||||
|
* will simply call task.trigger(), which respects buffering by default
|
||||||
*/
|
*/
|
||||||
public triggerBuffered(x?): Promise<any> {
|
public triggerBuffered(x?): Promise<any> {
|
||||||
return this.bufferRunner.trigger(x);
|
return this.bufferRunner.trigger(x);
|
||||||
|
@ -15,10 +15,12 @@ export class TaskDebounced<T = unknown> extends Task {
|
|||||||
name: optionsArg.name,
|
name: optionsArg.name,
|
||||||
taskFunction: async (x: T) => {
|
taskFunction: async (x: T) => {
|
||||||
this._observableIntake.push(x);
|
this._observableIntake.push(x);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
this.taskFunction = optionsArg.taskFunction;
|
this.taskFunction = optionsArg.taskFunction;
|
||||||
this._observableIntake.observable.pipe(plugins.smartrx.rxjs.ops.debounceTime(optionsArg.debounceTimeInMillis)).subscribe((x) => {
|
this._observableIntake.observable
|
||||||
|
.pipe(plugins.smartrx.rxjs.ops.debounceTime(optionsArg.debounceTimeInMillis))
|
||||||
|
.subscribe((x) => {
|
||||||
this.taskFunction(x);
|
this.taskFunction(x);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,7 @@ export class TaskManager {
|
|||||||
*/
|
*/
|
||||||
public addAndScheduleTask(taskArg: Task, cronStringArg: string) {
|
public addAndScheduleTask(taskArg: Task, cronStringArg: string) {
|
||||||
this.addTask(taskArg);
|
this.addTask(taskArg);
|
||||||
const taskName = taskArg.name;
|
this.scheduleTaskByName(taskArg.name, cronStringArg);
|
||||||
this.scheduleTaskByName(taskName, cronStringArg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +73,6 @@ export class TaskManager {
|
|||||||
await taskToSchedule.triggerBuffered();
|
await taskToSchedule.triggerBuffered();
|
||||||
});
|
});
|
||||||
taskToSchedule.cronJob = cronJob;
|
taskToSchedule.cronJob = cronJob;
|
||||||
this.cronJobManager.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,4 +102,18 @@ export class TaskManager {
|
|||||||
* @param taskNameArg
|
* @param taskNameArg
|
||||||
*/
|
*/
|
||||||
public getSchedulesForTaskName(taskNameArg: string) {}
|
public getSchedulesForTaskName(taskNameArg: string) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts the taskmanager
|
||||||
|
*/
|
||||||
|
public start() {
|
||||||
|
this.cronJobManager.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stops the taskmanager
|
||||||
|
*/
|
||||||
|
public stop() {
|
||||||
|
this.cronJobManager.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user