FirebaseExtended / firebase-queue

MIT License
786 stars 108 forks source link

Chaining three tasks #30

Closed kpgarrod closed 9 years ago

kpgarrod commented 9 years ago

I am trying out firebase-queue and mostly enjoying the experience so far :).

I am experiencing one issue though. When I chain tasks, say:

{ "task_a" : { "error_state" : "queue_error_queue", "finished_state" : "task_b", "in_progress_state" : "task_a_in_progress", "retries" : 5, "start_state" : "task_a", "timeout" : 300000 }, "task_b" : { "error_state" : "queue_error_queue", "finished_state" : "task_c", "in_progress_state" : "task_b_in_progress", "start_state" : "task_b", "timeout" : 5000 }, "task_c" : { "in_progress_state" : "task_c_in_progress", "start_state" : "task_c", "timeout" : 5000 } }

When I start with task_a, task_a and task_b run as I expect. When I start with task_b, task_b runs as expected, but task_c does not.

The task is left in this state:

{ "_progress" : 100, "_state" : "task_c", "_state_changed" : 1438093533931, "myData" : {content: 'removed' } }

If I restart the server, the task runs to completion as I expect.

Any suggestions please?

cbraynor commented 9 years ago

I'm assuming myData is populated with your data - {} pushed to a location in Firebase causes the key to be removed.

Assuming that, it doesn't look like the task is being claimed. You can add:

var winston = require('winston');
winston.level = 'debug';

Before you initialize the queue to get better debug logging. (you need to npm install winston)

What version of Node are you running? Some 0.11 versions are based on a V8 build with a broken sha implementation, which causes issues in the underlying Firebase client.

Besides that, you could also add:

var Firebase = require('firebase');
Firebase.enableLogging(true);

Again before initializing the queue, which will turn on the underlying Firebase debug logs

kpgarrod commented 9 years ago

@drtriumph: thanks for the response. Yes, myData has valid content, I have corrected the comment above to indicate that. I am using node.js v0.12.0.

kpgarrod commented 9 years ago

My bad. It seems my code was not resolving a promise correctly in some circumstances.

cbraynor commented 9 years ago

I'm glad you found the cause, thank you for the follow-up