You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure where to start debugging this except by creating a long running process that does this:
connect to database
get item
write item to console
sleep
goto 2
When running the process along, it will read one item then quit after it sleeps (when it attempts to read an item again)
If I add a second setTimeout and just loops and does nothing to keep the process alone, it's the only one that does anything (after the first read).
When I start 2 processes with the same script, the second one to start will read the item in the loop as expected. If I kill the first process (the "leader"), the second process becomes the "leader" and stops reading from the database.
I'm not sure if this is because the "leader" is a client and server and there's an error that's not propagating or if there's some other cause to this.
Update
I did some more tests and it seems to only happen when using accountdown and using the .list() method (which returns a stream).
Here's the script that I was using. I have the timeouts set high in this case so I can switch to another console and start it again. After the "leader" dies, and another "leader" is elected, it stops reading, then dies.
varmkdirp=require('mkdirp');varlevel=require('level-party');varsublevel=require('level-sublevel');varaccountdown=require('accountdown');mkdirp.sync('./tmp/data');vardb=level('./tmp/data')db.on('leader',console.log.bind(console,"I'm the leader"));// db = sublevel(db);varaccounts=accountdown(db,{login: {basic: require('accountdown-basic')}});varstart=newDate();functionwriteMsg(){varopts={login: {basic: {username: 'doowb',password: 'password'}},value: {name: 'Brian Woodward'}};accounts.create('doowb',opts,function(err){setTimeout(writeMsg,10000);});// var diff = (new Date()) - start;// db.put('time', diff.toString(), function (err) {// if (err) console.error('Error writing diff', err);// setTimeout(writeMsg, 1000);// });}functionreadMsg(){accounts.list().on('data',console.log).on('end',function(){setTimeout(readMsg,2000);});// db.get('time', function (err, diff) {// if (err && err.notFound) console.error('Message not found', err);// if (err && !err.notFound) console.error('Error', err);// console.log('Diff:', diff);// setTimeout(readMsg, 200);// });}writeMsg();setTimeout(readMsg,5000);
The text was updated successfully, but these errors were encountered:
I'm not sure where to start debugging this except by creating a long running process that does this:
When running the process along, it will read one item then quit after it sleeps (when it attempts to read an item again)
If I add a second
setTimeout
and just loops and does nothing to keep the process alone, it's the only one that does anything (after the first read).When I start 2 processes with the same script, the second one to start will read the item in the loop as expected. If I kill the first process (the "leader"), the second process becomes the "leader" and stops reading from the database.
I'm not sure if this is because the "leader" is a client and server and there's an error that's not propagating or if there's some other cause to this.
Update
I did some more tests and it seems to only happen when using
accountdown
and using the.list()
method (which returns a stream).Here's the script that I was using. I have the timeouts set high in this case so I can switch to another console and start it again. After the "leader" dies, and another "leader" is elected, it stops reading, then dies.
The text was updated successfully, but these errors were encountered: