Comparing version 0.0.3 to 0.0.4
@@ -11,3 +11,3 @@ export interface Config { | ||
success: boolean; | ||
errors: string[]; | ||
error: string; | ||
meta: any; | ||
@@ -14,0 +14,0 @@ } |
@@ -30,3 +30,3 @@ "use strict"; | ||
item.success = false; | ||
item.errors = []; | ||
item.error = ''; | ||
item.meta = meta; | ||
@@ -36,3 +36,3 @@ yield Connection.client | ||
.zadd(`queue:${queue}`, timestamp, id) | ||
.hmset(`items:${queue}:${id}`, 'id', item.id, 'created', item.created, 'queue', item.queue, 'attempts', item.attempts, 'errors', item.errors.join('|||'), 'meta', JSON.stringify(item.meta)) | ||
.hmset(`items:${queue}:${id}`, 'id', item.id, 'created', item.created, 'queue', item.queue, 'attempts', item.attempts, 'success', item.success, 'error', '', 'meta', JSON.stringify(item.meta)) | ||
.exec(); | ||
@@ -116,6 +116,2 @@ return id; | ||
} | ||
let errors = []; | ||
if (data.errors !== '') { | ||
errors = data.errors.split(/\|\|\|/); | ||
} | ||
let item = { | ||
@@ -126,4 +122,4 @@ id: data.id, | ||
attempts: parseInt(data.attempts), | ||
success: Boolean(data.success), | ||
errors: errors, | ||
success: (data.success === 'true'), | ||
error: data.error, | ||
meta: JSON.parse(data.meta) | ||
@@ -148,2 +144,3 @@ }; | ||
.zrem(`processing:${item.queue}`, item.id) | ||
.hset(`items:${item.queue}:${item.id}`, 'success', 'true') | ||
.expire(`items:${item.queue}:${item.id}`, config.retention || 60 * 60 * 24) | ||
@@ -164,3 +161,3 @@ .zadd(`success:${item.queue}`, completedTimestamp, item.id) | ||
.zadd(`error:${item.queue}`, completedTimestamp, item.id) | ||
.hset(`data:${item.queue}:${item.id}`, 'error', JSON.stringify(item.errors.push(err.message))) | ||
.hset(`data:${item.queue}:${item.id}`, 'error', err.message) | ||
.exec(); | ||
@@ -167,0 +164,0 @@ } |
{ | ||
"name": "qonvoy", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "An extremely minimal task runner", | ||
@@ -5,0 +5,0 @@ "main": "./build/qonvoy.js", |
@@ -17,3 +17,3 @@ const uuid = require('uuid/v4') | ||
success: boolean, | ||
errors: string[], | ||
error: string, | ||
meta: any | ||
@@ -39,3 +39,3 @@ } | ||
item.success = false | ||
item.errors = [] | ||
item.error = '' | ||
item.meta = meta | ||
@@ -52,3 +52,4 @@ | ||
'attempts', item.attempts, | ||
'errors', item.errors.join('|||'), | ||
'success', item.success, | ||
'error', '', | ||
'meta', JSON.stringify(item.meta) | ||
@@ -155,8 +156,2 @@ ) | ||
let errors = [] | ||
if (data.errors !== '') { | ||
errors = data.errors.split(/\|\|\|/) | ||
} | ||
let item = <Item>{ | ||
@@ -167,4 +162,4 @@ id: data.id, | ||
attempts: parseInt(data.attempts), | ||
success: Boolean(data.success), | ||
errors: errors, | ||
success: (data.success === 'true'), | ||
error: data.error, | ||
meta: JSON.parse(data.meta) | ||
@@ -201,2 +196,7 @@ } | ||
.zrem(`processing:${item.queue}`, item.id) | ||
.hset( | ||
`items:${item.queue}:${item.id}`, | ||
'success', | ||
'true' | ||
) | ||
.expire( | ||
@@ -225,3 +225,3 @@ `items:${item.queue}:${item.id}`, | ||
'error', | ||
JSON.stringify(item.errors.push(err.message)) | ||
err.message | ||
) | ||
@@ -228,0 +228,0 @@ .exec() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19473
537