Skip to content

Commit

Permalink
fix: parse progres and return value in events
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Aug 24, 2019
1 parent 18d4afe commit 9e43d0e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/classes/queue-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ export class QueueEvents extends QueueBase {
for (let i = 0; i < events.length; i++) {
id = events[i][0];
const args = array2obj(events[i][1]);

//
// TODO: we may need to have a separate xtream for progress data
// to avoid this hack.
switch (args.event) {
case 'progress':
args.data = JSON.parse(args.data);
break;
case 'completed':
args.returnvalue = JSON.parse(args.returnvalue);
break;
}

this.emit(args.event, args, id);
this.emit(`${args.event}:${args.jobId}`, args, id);
}
Expand Down

0 comments on commit 9e43d0e

Please sign in to comment.