Let's look at a simplified version of the code:
var queueTask = function (taskObject) {
var deferred = $q.defer();
// Creating a new task reference & pushing a new Task object to that location
var newTaskRef = firebase.database().ref("task").push(taskObject);
newTaskRef.once('child_removed', function (snapshot){
// SUCCESS
console.log("@DEBUG - TASK COMPLETE/CHILD REMOVED");
deferred.resolve(snapshot);
});
return deferred.promise;
};
(A server-side worker processes the task, writes the result to another database location, and then deletes the object.)
Although the Task object is deleted, the child-removed
event never seems to fire.
What could be causing the child-removed
event to not trigger?