Fix counter stuck & not gen pregen xpop

This commit is contained in:
Wietse Wind
2023-10-15 00:28:38 +02:00
parent 9b73f8c408
commit 7a09ec4163
2 changed files with 45 additions and 39 deletions

View File

@@ -58,7 +58,7 @@ services:
healthcheck: healthcheck:
test: TTL_MINUTES_PREGEN_XPOP=${TTL_MINUTES_PREGEN_XPOP:-60} TTL_DAYS_XPOP_SOURCE_FILES=${TTL_DAYS_XPOP_SOURCE_FILES:-30} sh /cleanup.sh test: TTL_MINUTES_PREGEN_XPOP=${TTL_MINUTES_PREGEN_XPOP:-60} TTL_DAYS_XPOP_SOURCE_FILES=${TTL_DAYS_XPOP_SOURCE_FILES:-30} sh /cleanup.sh
interval: ${TTL_MINUTES_CLEANUP_INTERVAL:-60}m interval: ${TTL_MINUTES_CLEANUP_INTERVAL:-60}m
retries: 0 retries: 10
timeout: 55m timeout: 55m
volumes: volumes:
nginxcache: nginxcache:

View File

@@ -2,6 +2,7 @@ import { writeFile } from 'fs'
import { dirExists } from './dirExists.mjs' import { dirExists } from './dirExists.mjs'
import { ledgerIndexToFolders } from './ledgerIndexToFolders.mjs' import { ledgerIndexToFolders } from './ledgerIndexToFolders.mjs'
import { xpopGenerate } from './xpopGenerate.mjs' import { xpopGenerate } from './xpopGenerate.mjs'
import { createDirectory } from './createDirectory.mjs'
import { waitForLedgerReady } from './events/ledgerReady.mjs' import { waitForLedgerReady } from './events/ledgerReady.mjs'
import { emit } from '../bin/webserver.mjs' import { emit } from '../bin/webserver.mjs'
import 'dotenv/config' import 'dotenv/config'
@@ -68,7 +69,13 @@ const onTransaction = async ({
networkId, networkId,
txHash: tx.hash, txHash: tx.hash,
}) })
if (await dirExists(xpopBinaryDir)) {
if (!(await dirExists(xpopBinaryDir))) {
console.log('(Re-) creating /store/xpop directory')
await createDirectory('store/xpop')
}
const xpopWritten = await new Promise(resolve => { const xpopWritten = await new Promise(resolve => {
writeFile(xpopBinaryDir + '/' + tx.hash, Buffer.from(xpopBinary, 'utf8'), err => { writeFile(xpopBinaryDir + '/' + tx.hash, Buffer.from(xpopBinary, 'utf8'), err => {
if (err) { if (err) {
@@ -115,7 +122,6 @@ const onTransaction = async ({
} }
} }
} }
}
} }
export { export {