Skip to content

Commit

Permalink
keep daemon from crashing perhaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jtremback committed Oct 2, 2014
1 parent c313f4d commit 0b7daaa
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/models/block_io-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ module.exports = function (confirmations, timeout) {

(function daemon () {
blockIo.get_my_addresses({}, function (err, result) {
if (err) eventEmitter.emit('error', err);

result.data.addresses.forEach(function (address) {
blockIo.get_address_received({'address': address.address}, function (err, result) {
if (err) console.log('blockio daemon error: `', err);
updateBalance(result.data.address, result.data.confirmed_received, function (err, result) {
if (err) { console.log(err, result); }
if (err) {
console.log('Block IO daemon error: ', err);
} else {
result.data.addresses.forEach(function (address) {
blockIo.get_address_received({'address': address.address}, function (err, result) {
if (err) console.log('blockio daemon error: `', err);
updateBalance(result.data.address, result.data.confirmed_received, function (err, result) {
if (err) { console.log(err, result); }
});
});
});
});

setTimeout(daemon, timeout);
setTimeout(daemon, timeout);
}
});
})();

Expand Down

0 comments on commit 0b7daaa

Please sign in to comment.