Skip to content

Commit

Permalink
Add default busy timeout for spellrunner env
Browse files Browse the repository at this point in the history
  • Loading branch information
parzival418 committed Oct 28, 2023
1 parent 687810c commit 4cf8d45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/config/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ export const MANAGER_WARM_UP_MSEC =
Number(getVarForEnvironment('MANAGER_WARM_UP_MSEC')) || 5000

export const API_ACCESS_KEY = getVarForEnvironment('API_ACCESS_KEY') || 'apiKey'

export const SPELLRUNNER_BUSY_TIMEOUT_MSEC = getVarForEnvironment(
'SPELLRUNNER_BUSY_TIMEOUT_MS'
)
? Number(getVarForEnvironment('SPELLRUNNER_BUSY_TIMEOUT_MS'))
: 120000
3 changes: 2 additions & 1 deletion packages/core/shared/src/spellManager/SpellRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { extractModuleInputKeys } from './graphHelpers'
import SpellManager from './SpellManager'
import { getLogger } from '../logger'
import { NodeData } from 'rete/types/core/data'
import { SPELLRUNNER_BUSY_TIMEOUT_MSEC } from '@magickml/config'

export type RunComponentArgs = {
inputs: MagickSpellInput
Expand Down Expand Up @@ -377,7 +378,7 @@ class SpellRunner {
// A run shouldnt take this long. This is a hacl but we are replacing all this soon.
setTimeout(() => {
this.busy = false
}, 120000)
}, SPELLRUNNER_BUSY_TIMEOUT_MSEC)

// this running is where the main "work" happens.
// I do wonder whether we could make this even more elegant by having the node
Expand Down

0 comments on commit 4cf8d45

Please sign in to comment.