Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
8f9b3151d8 | |||
81e97b513a | |||
7da0035805 | |||
16a77e4c41 | |||
495f63ec71 | |||
17f840d24c | |||
b93407e83a | |||
003c1f2796 | |||
7f72a88846 | |||
823d4f7d55 | |||
7d57fcf07e | |||
eb9ae2fa71 | |||
5fe60c6e50 | |||
6f811b4ab5 | |||
2cf32ac723 | |||
09936fda56 |
@ -19,23 +19,35 @@ mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- 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
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- 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:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
@ -50,9 +62,7 @@ testStable:
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -63,9 +73,7 @@ testBuild:
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@ -85,6 +93,8 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
package-lock.json
generated
30
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"version": "2.1.5",
|
||||
"version": "2.1.13",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1589,9 +1589,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartlog": {
|
||||
"version": "2.0.36",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.36.tgz",
|
||||
"integrity": "sha512-guM03567UFZebx3urBQdiQecZwKvrR8c8fzt7EDPrI1ihArZc7ab6MQEu9yklPKqJMGLEz8t0oExgQ8804r73g==",
|
||||
"version": "2.0.37",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.37.tgz",
|
||||
"integrity": "sha512-EfF/Zp8tpRdJwZtwFMeQdurd4wEvT2S/kx9iRf362aER93wyO8NUuGyyN6U52hgEN5r1VDgG27lpNXc+ZKwRMw==",
|
||||
"requires": {
|
||||
"@pushrocks/isounique": "^1.0.4",
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.20"
|
||||
@ -1973,15 +1973,15 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smarttime": {
|
||||
"version": "3.0.24",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.24.tgz",
|
||||
"integrity": "sha512-c/n0Y3CUnVNa3TnuXZ5aRc0bWj4RX7+XSjPes1J4HidU1yBOd9UOt6l08W8aPH5jMjT9Ei2jH0GsheaTGoVEYA==",
|
||||
"version": "3.0.35",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.35.tgz",
|
||||
"integrity": "sha512-KBDprr2gMcw+21kD6GkJ0Y9fc/SuMijhFPDKoBmuCW9Nhn+KAnabCB8Qn8OzeUuQcoHQ3SFJ/4KioJWNxMgxaQ==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"croner": "^1.1.23",
|
||||
"dayjs": "^1.8.29",
|
||||
"dayjs": "^1.8.35",
|
||||
"is-nan": "^1.3.0"
|
||||
}
|
||||
},
|
||||
@ -2297,9 +2297,9 @@
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.6.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.6.2.tgz",
|
||||
"integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A=="
|
||||
"version": "14.6.4",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.6.4.tgz",
|
||||
"integrity": "sha512-Wk7nG1JSaMfMpoMJDKUsWYugliB2Vy55pdjLpmLixeyMi7HizW2I/9QoxsPCkXl3dO+ZOVqPumKaDUv5zJu2uQ=="
|
||||
},
|
||||
"@types/parcel-bundler": {
|
||||
"version": "1.12.1",
|
||||
@ -4185,9 +4185,9 @@
|
||||
}
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.8.29",
|
||||
"resolved": "https://verdaccio.lossless.one/dayjs/-/dayjs-1.8.29.tgz",
|
||||
"integrity": "sha512-Vm6teig8ZWK7rH/lxzVGxZJCljPdmUr6q/3f4fr5F0VWNGVkZEjZOQJsAN8hUHUqn+NK4XHNEpJZS1MwLyDcLw=="
|
||||
"version": "1.8.35",
|
||||
"resolved": "https://verdaccio.lossless.one/dayjs/-/dayjs-1.8.35.tgz",
|
||||
"integrity": "sha512-isAbIEenO4ilm6f8cpqvgjZCsuerDAz2Kb7ri201AiNn58aqXuaLJEnCtfIMdCvERZHNGRY5lDMTr/jdAnKSWQ=="
|
||||
},
|
||||
"deasync": {
|
||||
"version": "0.1.20",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"version": "2.1.5",
|
||||
"version": "2.1.13",
|
||||
"private": false,
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -29,10 +29,10 @@
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartlog": "^2.0.36",
|
||||
"@pushrocks/smartlog": "^2.0.37",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartrx": "^2.0.18",
|
||||
"@pushrocks/smarttime": "^3.0.24",
|
||||
"@pushrocks/smarttime": "^3.0.35",
|
||||
"@types/cron": "^1.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -40,7 +40,7 @@
|
||||
"@gitzone/tsbundle": "^1.0.78",
|
||||
"@gitzone/tstest": "^1.0.44",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.6.2",
|
||||
"@types/node": "^14.6.4",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
|
@ -4,7 +4,6 @@ export class BufferRunner {
|
||||
public task: Task;
|
||||
// initialze by default
|
||||
public bufferCounter: number = 0;
|
||||
public running: boolean = false;
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
@ -16,7 +15,7 @@ export class BufferRunner {
|
||||
const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(
|
||||
this.bufferCounter + 1
|
||||
);
|
||||
if (!this.running) {
|
||||
if (!this.task.running) {
|
||||
this._run(x);
|
||||
}
|
||||
return returnPromise;
|
||||
@ -25,15 +24,13 @@ export class BufferRunner {
|
||||
private _run(x) {
|
||||
const recursiveBufferRunner = (x) => {
|
||||
if (this.bufferCounter >= 0) {
|
||||
this.running = true;
|
||||
this.task.running = true;
|
||||
Task.runTask(this.task, { x: x }).then((x) => {
|
||||
this.bufferCounter--;
|
||||
this.bufferCounter--; // this.bufferCounter drops below 0, the recursion stops.
|
||||
this.task.cycleCounter.informOfCycle(x);
|
||||
recursiveBufferRunner(x);
|
||||
});
|
||||
} else {
|
||||
this.running = false;
|
||||
this.task.running = false;
|
||||
}
|
||||
};
|
||||
|
@ -200,6 +200,7 @@ export class Task {
|
||||
|
||||
/**
|
||||
* trigger task unbuffered.
|
||||
* will actually run the task, not considering any buffered limits.
|
||||
*/
|
||||
public triggerUnBuffered(x?): Promise<any> {
|
||||
return Task.runTask(this, { x: x });
|
||||
@ -207,6 +208,7 @@ export class Task {
|
||||
|
||||
/**
|
||||
* trigger task buffered.
|
||||
* will simply call task.trigger(), which respects buffering by default
|
||||
*/
|
||||
public triggerBuffered(x?): Promise<any> {
|
||||
return this.bufferRunner.trigger(x);
|
||||
|
@ -15,11 +15,13 @@ export class TaskDebounced<T = unknown> extends Task {
|
||||
name: optionsArg.name,
|
||||
taskFunction: async (x: T) => {
|
||||
this._observableIntake.push(x);
|
||||
}
|
||||
},
|
||||
});
|
||||
this.taskFunction = optionsArg.taskFunction;
|
||||
this._observableIntake.observable.pipe(plugins.smartrx.rxjs.ops.debounceTime(optionsArg.debounceTimeInMillis)).subscribe((x) => {
|
||||
this.taskFunction(x);
|
||||
});
|
||||
this._observableIntake.observable
|
||||
.pipe(plugins.smartrx.rxjs.ops.debounceTime(optionsArg.debounceTimeInMillis))
|
||||
.subscribe((x) => {
|
||||
this.taskFunction(x);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,7 @@ export class TaskManager {
|
||||
*/
|
||||
public addAndScheduleTask(taskArg: Task, cronStringArg: string) {
|
||||
this.addTask(taskArg);
|
||||
const taskName = taskArg.name;
|
||||
this.scheduleTaskByName(taskName, cronStringArg);
|
||||
this.scheduleTaskByName(taskArg.name, cronStringArg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user