Improve graphs backfill resilience
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m56s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m56s
This commit is contained in:
18
src/index.ts
18
src/index.ts
@@ -34,6 +34,14 @@ app.get('/api/trigger-backfill', (req: Request, res: Response) => {
|
||||
detached: true,
|
||||
stdio: 'inherit' // Inherit allows the logs to show up in Portainer's log viewer!
|
||||
});
|
||||
|
||||
child.on('error', (error) => {
|
||||
console.error(`[server]: Backfill process failed to start: ${error.message}`);
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
console.log(`[server]: Backfill process exited. code=${code ?? 'null'} signal=${signal ?? 'null'}`);
|
||||
});
|
||||
|
||||
child.unref();
|
||||
|
||||
@@ -60,6 +68,7 @@ app.get('/api/trigger-graphs-backfill', (req: Request, res: Response) => {
|
||||
maxOrders: 'GRAPHS_BACKFILL_MAX_ORDERS',
|
||||
maxDays: 'GRAPHS_BACKFILL_MAX_DAYS',
|
||||
contactFallback: 'GRAPHS_BACKFILL_CONTACT_FALLBACK',
|
||||
sellerFallback: 'GRAPHS_BACKFILL_SELLER_FALLBACK',
|
||||
tinyRequestDelayMs: 'GRAPHS_BACKFILL_TINY_REQUEST_DELAY_MS',
|
||||
orderDelayMs: 'GRAPHS_BACKFILL_ORDER_DELAY_MS',
|
||||
blockDelayMs: 'GRAPHS_BACKFILL_TINY_BLOCK_DELAY_MS',
|
||||
@@ -83,6 +92,14 @@ app.get('/api/trigger-graphs-backfill', (req: Request, res: Response) => {
|
||||
env
|
||||
});
|
||||
|
||||
child.on('error', (error) => {
|
||||
console.error(`[server]: Graphs backfill process failed to start: ${error.message}`);
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
console.log(`[server]: Graphs backfill process exited. code=${code ?? 'null'} signal=${signal ?? 'null'}`);
|
||||
});
|
||||
|
||||
child.unref();
|
||||
|
||||
console.log('[server]: Graphs backfill script manually triggered via HTTP endpoint.');
|
||||
@@ -96,6 +113,7 @@ app.get('/api/trigger-graphs-backfill', (req: Request, res: Response) => {
|
||||
maxOrders: env.GRAPHS_BACKFILL_MAX_ORDERS || null,
|
||||
maxDays: env.GRAPHS_BACKFILL_MAX_DAYS || null,
|
||||
contactFallback: env.GRAPHS_BACKFILL_CONTACT_FALLBACK || 'true',
|
||||
sellerFallback: env.GRAPHS_BACKFILL_SELLER_FALLBACK || 'true',
|
||||
tinyRequestDelayMs: env.GRAPHS_BACKFILL_TINY_REQUEST_DELAY_MS || '6000',
|
||||
orderDelayMs: env.GRAPHS_BACKFILL_ORDER_DELAY_MS || '0',
|
||||
blockDelayMs: env.GRAPHS_BACKFILL_TINY_BLOCK_DELAY_MS || '600000',
|
||||
|
||||
Reference in New Issue
Block a user