Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Fixes #276. Finishing snapshot within __private.applyBlock.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Beddows committed Sep 18, 2016
1 parent 1aee225 commit b64df59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion modules/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,15 @@ __private.applyBlock = function (block, broadcast, cb, saveBlock) {
} else {
library.bus.message('newBlock', block, broadcast);
// DATABASE write. Update delegates accounts
modules.round.tick(block, done);
modules.round.tick(block, function (err) {
if (err === 'Snapshot finished') {
__private.isActive = false;
library.logger.info(err);
process.emit('SIGTERM');
} else {
done(err);
}
});
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion modules/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Round.prototype.tick = function (block, done) {
}
], function (err) {
if (scope.finishSnapshot) {
process.emit('SIGTERM');
return done('Snapshot finished');
} else {
return done(err);
}
Expand Down

0 comments on commit b64df59

Please sign in to comment.