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 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(this.data);
131
+ console.log(data);
132
+ console.log(meta);
132
133
  // do your background work
133
- let a = this.data.price;
134
- let b = this.data.value;
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
@@ -12,7 +12,7 @@ let memory = module.exports;
12
12
  /**
13
13
  * version
14
14
  */
15
- memory.version = "1.2.11";
15
+ memory.version = "1.3.1";
16
16
 
17
17
  /**
18
18
  * Memory
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.call({
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-sri",
3
- "version": "1.2.11",
3
+ "version": "1.3.1",
4
4
  "description": "Powerful yet simple memory and queue manager for building efficient Node.js apps.",
5
5
  "scripts": {
6
6
  "test": "npx jest ---coverage=false --detectOpenHandles --forceExit",