Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Created August 10, 2012 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briancavalier/3309660 to your computer and use it in GitHub Desktop.
Save briancavalier/3309660 to your computer and use it in GitHub Desktop.
Infinite loop interaction between q.js and when.js
// `npm install q when`
// `node test.js`
// watch CPU and memory using top
var q, when;
q = require('q');
when = require('when/debug');
// Infinite loop
q.resolve(1).then(when.resolve)
.then(console.log, console.error);
// Infinite loop
//when.resolve(1).then(q.resolve)
// .then(console.log, console.error);
// Works correctly
//q.resolve(1).then(q.resolve)
// .then(console.log, console.error);
// Works correctly
//when.resolve(1).then(when.resolve)
// .then(console.log, console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment