4

I have a firebase-worker (https://github.com/firebase/firebase-queue) running on node. I have a big backlog of one particular task that the worker needs to do, but often times the task fails and then the worker simply stops with the below error message:

Oct 13 20:34:57 Worker app/low_priority_worker.1:  FIREBASE WARNING: transaction at /low_priority_queue/tasks/-KTupoITHgT10u5uasQq failed: disconnect
Oct 13 20:34:57 Worker app/low_priority_worker.1:  FIREBASE WARNING: transaction at /user_dashboard/-JmteP57yEdeDFzAyv-p/1476403200000/views/-KTuI5464YGfBx9KEmNs failed: disconnect

The task the worker is doing, is to increment a value on a Firebase path:

# Increment comment amount on listing
incrementDashboardListingTypeAmountPromise = BaseHelper.firebaseDatabase.ref("user_dashboard").child(@data.seller_id).child("#{Date.create().setUTC(true).beginningOfDay().format("{x}")}").child(@data.type).child(@data.listing_id).transaction (currentValue) ->
  (currentValue || 0) + 1

# Promise callback
Promise.all([incrementDashboardListingTypeAmountPromise].compact()).then (results) =>
  # Execute callback
  callback()

On the last "callback()", the task gets resolved and it goes on to the next task. Am I doing something wrong here? Am I missing some error handling?

Holger Sindbaek
  • 2,278
  • 6
  • 41
  • 68

0 Answers0