Browse Source
Merge pull request #7382 from Budibase/handle-stalled-crons
Handle stalled crons
master
Rory Powell
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
8 additions and
4 deletions
-
packages/server/src/automations/listeners.ts
-
packages/server/src/threads/automation.ts
-
packages/server/src/utilities/queue/inMemoryQueue.js
|
|
|
@ -4,11 +4,11 @@ import * as automation from "../threads/automation" |
|
|
|
|
|
|
|
export const addListeners = (queue: Queue) => { |
|
|
|
logging(queue) |
|
|
|
// handleStalled(queue)
|
|
|
|
handleStalled(queue) |
|
|
|
} |
|
|
|
|
|
|
|
const handleStalled = (queue: Queue) => { |
|
|
|
queue.on("active", async (job: Job) => { |
|
|
|
queue.on("stalled", async (job: Job) => { |
|
|
|
await automation.removeStalled(job as AutomationEvent) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@ -473,9 +473,9 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export const removeStalled = (input: AutomationEvent) => { |
|
|
|
export const removeStalled = async (input: AutomationEvent) => { |
|
|
|
const appId = input.data.event.appId |
|
|
|
doInAppContext(appId, async () => { |
|
|
|
await doInAppContext(appId, async () => { |
|
|
|
const automationOrchestrator = new Orchestrator( |
|
|
|
input.data.automation, |
|
|
|
input.data.event, |
|
|
|
|
|
|
|
@ -113,6 +113,10 @@ class InMemoryQueue { |
|
|
|
async getJob() { |
|
|
|
return {} |
|
|
|
} |
|
|
|
|
|
|
|
on() { |
|
|
|
// do nothing
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = InMemoryQueue |
|
|
|
|