Skip to content

Commit

Permalink
Update timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
pastelsky committed Jan 2, 2024
1 parent 953474b commit da824fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ config({
function killAllBullMQProcesses(processName: string) {
if (process.env.NODE_ENV !== "production") return;

const command = `ps aux | grep '${processName}' | grep -v grep | awk '{print $2}' | xargs -r kill -9`;
const ageInSeconds = 30;
const command = `ps aux | grep '${processName}' | grep -v grep | awk '{split($10,a,":"); if (a[1] * 60 + a[2] > ${ageInSeconds}) print $2}' | xargs -r kill -9`;
try {
execSync(command);
console.log(`Killed processes with name containing '${processName}'`);
Expand Down

0 comments on commit da824fb

Please sign in to comment.