Removing Sigterm. Cache write block interval configuration.

This commit is contained in:
softsimon
2023-03-20 15:23:02 +09:00
parent 2a8b49d40c
commit e1770cc9a2
14 changed files with 26 additions and 15 deletions

View File

@@ -651,7 +651,7 @@ class Blocks {
if (this.newBlockCallbacks.length) {
this.newBlockCallbacks.forEach((cb) => cb(blockExtended, txIds, transactions));
}
if (!memPool.hasPriority() && (block.height % 6 === 0)) {
if (!memPool.hasPriority() && (block.height % config.MEMPOOL.DISK_CACHE_BLOCK_INTERVAL === 0)) {
diskCache.$saveCacheToDisk();
}

View File

@@ -19,16 +19,12 @@ class DiskCache {
private isWritingCache = false;
constructor() {
if (!cluster.isMaster) {
if (!cluster.isPrimary) {
return;
}
process.on('SIGINT', (e) => {
this.$saveCacheToDisk(true);
process.exit(2);
});
process.on('SIGTERM', (e) => {
this.$saveCacheToDisk(true);
process.exit(2);
process.exit(0);
});
}