@push.rocks/taskbuffer 3.0.12 → 3.0.15
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_bundle/bundle.js +26 -29
- package/dist_bundle/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/taskbuffer.classes.bufferrunner.d.ts +1 -1
- package/dist_ts/taskbuffer.classes.bufferrunner.js +1 -1
- package/dist_ts/taskbuffer.classes.cyclecounter.d.ts +1 -1
- package/dist_ts/taskbuffer.classes.cyclecounter.js +1 -1
- package/dist_ts/taskbuffer.classes.task.d.ts +21 -53
- package/dist_ts/taskbuffer.classes.task.js +9 -23
- package/dist_ts/taskbuffer.classes.taskmanager.d.ts +6 -6
- package/dist_ts/taskbuffer.classes.taskmanager.js +13 -7
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/taskbuffer.classes.bufferrunner.ts +1 -1
- package/ts/taskbuffer.classes.cyclecounter.ts +1 -1
- package/ts/taskbuffer.classes.task.ts +36 -72
- package/ts/taskbuffer.classes.taskmanager.ts +14 -6
package/dist_bundle/bundle.js
CHANGED
|
@@ -5926,7 +5926,6 @@ var logger = new dist_ts_exports9.ConsoleLog();
|
|
|
5926
5926
|
// ts/taskbuffer.classes.task.ts
|
|
5927
5927
|
var _Task = class {
|
|
5928
5928
|
constructor(optionsArg) {
|
|
5929
|
-
// initialize by default
|
|
5930
5929
|
this.running = false;
|
|
5931
5930
|
this.bufferRunner = new BufferRunner(this);
|
|
5932
5931
|
this.cycleCounter = new CycleCounter(this);
|
|
@@ -5940,6 +5939,7 @@ var _Task = class {
|
|
|
5940
5939
|
this.bufferMax = optionsArg.bufferMax;
|
|
5941
5940
|
this.execDelay = optionsArg.execDelay;
|
|
5942
5941
|
this.name = optionsArg.name;
|
|
5942
|
+
this.taskSetup = optionsArg.taskSetup;
|
|
5943
5943
|
}
|
|
5944
5944
|
// STATIC
|
|
5945
5945
|
static extractTask(preOrAfterTaskArg) {
|
|
@@ -5955,9 +5955,16 @@ var _Task = class {
|
|
|
5955
5955
|
return null;
|
|
5956
5956
|
}
|
|
5957
5957
|
}
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5958
|
+
static isTaskTouched(taskArg, touchedTasksArray) {
|
|
5959
|
+
const taskToCheck = _Task.extractTask(taskArg);
|
|
5960
|
+
let result = false;
|
|
5961
|
+
for (const keyArg in touchedTasksArray) {
|
|
5962
|
+
if (taskToCheck === touchedTasksArray[keyArg]) {
|
|
5963
|
+
result = true;
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5966
|
+
return result;
|
|
5967
|
+
}
|
|
5961
5968
|
trigger(x) {
|
|
5962
5969
|
if (this.buffered) {
|
|
5963
5970
|
return this.triggerBuffered(x);
|
|
@@ -5965,17 +5972,9 @@ var _Task = class {
|
|
|
5965
5972
|
return this.triggerUnBuffered(x);
|
|
5966
5973
|
}
|
|
5967
5974
|
}
|
|
5968
|
-
/**
|
|
5969
|
-
* trigger task unbuffered.
|
|
5970
|
-
* will actually run the task, not considering any buffered limits.
|
|
5971
|
-
*/
|
|
5972
5975
|
triggerUnBuffered(x) {
|
|
5973
5976
|
return _Task.runTask(this, { x });
|
|
5974
5977
|
}
|
|
5975
|
-
/**
|
|
5976
|
-
* trigger task buffered.
|
|
5977
|
-
* note: .trigger() also calls this function
|
|
5978
|
-
*/
|
|
5979
5978
|
triggerBuffered(x) {
|
|
5980
5979
|
return this.bufferRunner.trigger(x);
|
|
5981
5980
|
}
|
|
@@ -6003,19 +6002,12 @@ Task.isTask = (taskArg) => {
|
|
|
6003
6002
|
return false;
|
|
6004
6003
|
}
|
|
6005
6004
|
};
|
|
6006
|
-
Task.isTaskTouched = (taskArg, touchedTasksArray) => {
|
|
6007
|
-
const taskToCheck = _Task.extractTask(taskArg);
|
|
6008
|
-
let result = false;
|
|
6009
|
-
for (const keyArg in touchedTasksArray) {
|
|
6010
|
-
if (taskToCheck === touchedTasksArray[keyArg]) {
|
|
6011
|
-
result = true;
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
return result;
|
|
6015
|
-
};
|
|
6016
6005
|
Task.runTask = async (taskArg, optionsArg) => {
|
|
6017
6006
|
const taskToRun = _Task.extractTask(taskArg);
|
|
6018
6007
|
const done = dist_ts_exports.defer();
|
|
6008
|
+
if (!taskToRun.setupValue && taskToRun.taskSetup) {
|
|
6009
|
+
taskToRun.setupValue = await taskToRun.taskSetup();
|
|
6010
|
+
}
|
|
6019
6011
|
if (taskToRun.execDelay) {
|
|
6020
6012
|
await dist_ts_exports2.delayFor(taskToRun.execDelay);
|
|
6021
6013
|
}
|
|
@@ -6041,7 +6033,7 @@ Task.runTask = async (taskArg, optionsArg) => {
|
|
|
6041
6033
|
}
|
|
6042
6034
|
}).then(async (x2) => {
|
|
6043
6035
|
try {
|
|
6044
|
-
return await taskToRun.taskFunction(x2);
|
|
6036
|
+
return await taskToRun.taskFunction(x2, taskToRun.setupValue);
|
|
6045
6037
|
} catch (e) {
|
|
6046
6038
|
console.log(e);
|
|
6047
6039
|
}
|
|
@@ -6137,14 +6129,14 @@ var AbstractDistributedCoordinator = class {
|
|
|
6137
6129
|
|
|
6138
6130
|
// ts/taskbuffer.classes.taskmanager.ts
|
|
6139
6131
|
var TaskManager = class {
|
|
6140
|
-
constructor(
|
|
6132
|
+
constructor(optionsArg = {}) {
|
|
6141
6133
|
this.randomId = isounique2.uni();
|
|
6142
6134
|
this.taskMap = new dist_ts_exports5.ObjectMap();
|
|
6143
6135
|
this.cronJobManager = new dist_ts_exports6.CronManager();
|
|
6144
6136
|
this.options = {
|
|
6145
6137
|
distributedCoordinator: null
|
|
6146
6138
|
};
|
|
6147
|
-
this.options = Object.assign(this.options,
|
|
6139
|
+
this.options = Object.assign(this.options, optionsArg);
|
|
6148
6140
|
}
|
|
6149
6141
|
/**
|
|
6150
6142
|
* checks if a task is already present
|
|
@@ -6246,10 +6238,15 @@ var TaskManager = class {
|
|
|
6246
6238
|
await this.descheduleTaskByName(task.name);
|
|
6247
6239
|
}
|
|
6248
6240
|
/**
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6241
|
+
* returns the schedule of a specific task
|
|
6242
|
+
* @param taskNameArg
|
|
6243
|
+
*/
|
|
6244
|
+
getScheduleForTaskName(taskNameArg) {
|
|
6245
|
+
const task = this.getTaskByName(taskNameArg);
|
|
6246
|
+
if (!task || !task.cronJob) {
|
|
6247
|
+
return null;
|
|
6248
|
+
}
|
|
6249
|
+
return task.cronJob.cronExpression;
|
|
6253
6250
|
}
|
|
6254
6251
|
/**
|
|
6255
6252
|
* starts the taskmanager
|