Firebase queue - repetitions do not work?

Trying to figure out how to try.

this is my FB lineup:

{
  "specs" : {
    "default_spec" : {
      "retries" : 3,
      "timeout" : 60000
    }
  },
  "tasks" : {

  }
}

and this is how I test the repetitions work:

const queue = new Queue(getFirebaseRef(),{'numWorkers': 10} , function (data, progress, resolve, reject) {
        console.log('processing queue message:' + JSON.stringify(data));
        progress(50);

        setTimeout(()=>{
            reject(new Error("error while processing blabla"));

        },2000);
    });

so when I push the new task into the queue, here is what it looks like after being processed by my worker:

{
  "-KcsTIDBAq1S_fdiwsv6" : {
    "_error_details" : {
      "attempts" : 1,
      "error" : "error while processing blabla",
      "error_stack" : "Error: error while processing blabla\n    at Timeout.setTimeout ...,
      "previous_state" : "in_progress"
    },
    "_progress" : 50,
    "_state" : "error",
    "_state_changed" : 1487089675432,
    "body" : {
      "testing" : "this_is_a_test_task"
    }
  }
}

therefore, I expect that the attempts will be equal to 3, I also have no indications in the service that 3 tasks were processed.

The question is how can I make repetitions work. worth mentioning that this is what i did after reading the documentation

+4
source share
2 answers

, @Caerbannog, default_spec , Firebase.

, , :

var options = {
    'specId': "default_spec",
    'numWorkers': 10

};

var queueRef = getFirebaseRef();
var specs = {
    "default_spec": {
        "start_state": null,
        "in_progress_state": "in_progress",
        "finished_state": null,
        "error_state": "error",
        "timeout": 60000,
        "retries": 50
    }
};
queueRef.child('specs').set(specs);
+1

default_spec . :

{
  'numWorkers': 10,
  'specId': "default_spec"
}

, firebase:

https://github.com/firebase/firebase-queue/issues/106#issuecomment-279975546

+1

Source: https://habr.com/ru/post/1669722/


All Articles