FirebaseExtended / firebase-queue

MIT License
786 stars 108 forks source link

Process never terminates. #70

Closed AndersDJohnson closed 8 years ago

AndersDJohnson commented 8 years ago

Version info

Firebase: 2.4.2

Firebase Queue: 1.3.1

Node.js: 5.11.0

Other (e.g. operating system) (if applicable): OS X 10.11.5

Test case

var Firebase, Queue, queue;
Firebase = require('firebase');
Queue = require('firebase-queue');
queue = new Queue(new Firebase('https://fir-queue-forever.firebaseio.com'), function() {});
queue.shutdown().then(function() {
  return console.log('shut down');
});

Steps to reproduce

Run script above from a file with node on the command line.

Expected behavior

The process should terminate after shutdown.

Actual behavior

The process hangs forever.

cbraynor commented 8 years ago

This is a limitation of the way the current Firebase client handles the persistent connection and not an issue with the queue itself. The documentation suggests the workaround of a process.exit(0) in the .then(). A smaller repro would be:

var Firebase = require('firebase');
var ref = new Firebase('https://fir-queue-forever.firebaseio.com');
console.log('Process hangs forever...');
AndersDJohnson commented 8 years ago

@drtriumph Ah, thanks. That's unfortunate. How do you get your processes to close for your unit tests? I'm using tape not mocha, maybe that's my issue.