Skip to content

Commit

Permalink
Capture Docker stop signal. resolves #158
Browse files Browse the repository at this point in the history
  • Loading branch information
ngosang committed Aug 1, 2021
1 parent 2a4fae3 commit 4199db5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.ts
@@ -1,6 +1,7 @@
const fs = require('fs');
const os = require('os');
const path = require('path');
const process = require('process')
import log from './log'
import { createServer, IncomingMessage, ServerResponse } from 'http';
import { RequestContext } from './types'
Expand Down Expand Up @@ -118,7 +119,15 @@ function validateIncomingRequest(ctx: RequestContext, params: BaseAPICall) {
// init
log.info(`FlareSolverr ${version}`);
log.debug('Debug log enabled');

process.on('SIGTERM', () => {
// Capture signal on Docker Stop #158
log.info("Process interrupted")
process.exit(0)
})

validateEnvironmentVariables();

testChromeInstallation()
.catch(e => {
log.error("Error starting Chrome browser.", e);
Expand Down

0 comments on commit 4199db5

Please sign in to comment.