Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker never called #1

Closed
juliangruber opened this issue Aug 27, 2013 · 6 comments
Closed

worker never called #1

juliangruber opened this issue Aug 27, 2013 · 6 comments

Comments

@juliangruber
Copy link

in this code the worker is never called and the process just exits:

var level = require('level');                                                                                                                 
var Jobs = require('level-jobs');                                                                                                             

var db = level(__dirname + '/db');                                                                                                            
var jobs = Jobs(db, worker);                                                                                                                  

function worker (payload, done) {                                                                                                             
  console.log('called');                                                                                                                      
  done();                                                                                                                                     
};                                                                                                                                            

jobs.push({ foo: 'bar' });

when you add a callback to jobs.push, like jobs.push({foo:'bar'}, console.log), the worker is called.

@juliangruber
Copy link
Author

it's a race condition, if you insert a console.log somewhere in the source of level-jobs it works

@juliangruber
Copy link
Author

in this case https://github.com/pgte/level-jobs/blob/master/index.js#L65 is reached once but https://github.com/pgte/level-jobs/blob/master/index.js#L70 is never reached, which looks like a levelup bug.

@juliangruber
Copy link
Author

works with level@0.14.0, so def. a level bug

@juliangruber
Copy link
Author

see Level/levelup#181

@pgte
Copy link
Owner

pgte commented Aug 29, 2013

Using node 0.10 and level 0.14 and it works for me...

@juliangruber
Copy link
Author

yes, for me too, just level 0.15 is broken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants