memory-sri 1.2.11 → 1.3.1
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 +5 -4
- package/lib/main.js +1 -1
- package/lib/worker.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,12 +126,13 @@ const plus = function (a, b) {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
// register processor
|
|
129
|
-
Memory.process('test', async function () {
|
|
129
|
+
Memory.process('test', async function (data, meta) {
|
|
130
130
|
console.log("Running queued task with:");
|
|
131
|
-
console.log(
|
|
131
|
+
console.log(data);
|
|
132
|
+
console.log(meta);
|
|
132
133
|
// do your background work
|
|
133
|
-
let a =
|
|
134
|
-
let b =
|
|
134
|
+
let a = data.price;
|
|
135
|
+
let b = data.value;
|
|
135
136
|
let c = plus(a, b);
|
|
136
137
|
console.log(`total: ${c}`);
|
|
137
138
|
});
|
package/lib/main.js
CHANGED
package/lib/worker.js
CHANGED
|
@@ -37,7 +37,7 @@ Task.addTaskBE = function addTaskService(taskFn, data, timeout) {
|
|
|
37
37
|
logData(`Task must be a function`);
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
if(timeout !== 0){
|
|
40
|
+
if (timeout !== 0) {
|
|
41
41
|
taskIdBE += 1;
|
|
42
42
|
}
|
|
43
43
|
tasksBE.push({ id: taskIdBE, run: taskFn });
|
|
@@ -67,8 +67,7 @@ async function runTask(name) {
|
|
|
67
67
|
|
|
68
68
|
try {
|
|
69
69
|
task.attempts += 1;
|
|
70
|
-
const result = await fn.
|
|
71
|
-
data: task.data,
|
|
70
|
+
const result = await fn(task.data, {
|
|
72
71
|
id: task.id,
|
|
73
72
|
name: task.name,
|
|
74
73
|
});
|
package/package.json
CHANGED