MCPcopy Index your code
hub / github.com/simstudioai/sim / getJobQueue

Function getJobQueue

apps/sim/lib/core/async-jobs/config.ts:33–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 * Creates the appropriate backend based on environment configuration.
32 */
33export async function getJobQueue(): Promise<JobQueueBackend> {
34 if (cachedBackend) {
35 return cachedBackend
36 }
37
38 const type = getAsyncBackendType()
39
40 switch (type) {
41 case 'trigger-dev': {
42 const { TriggerDevJobQueue } = await import('@/lib/core/async-jobs/backends/trigger-dev')
43 cachedBackend = new TriggerDevJobQueue()
44 break
45 }
46 case 'database': {
47 const { DatabaseJobQueue } = await import('@/lib/core/async-jobs/backends/database')
48 cachedBackend = new DatabaseJobQueue()
49 break
50 }
51 }
52
53 cachedBackendType = type
54 logger.info(`Async job backend initialized: ${type}`)
55
56 if (!cachedBackend) {
57 throw new Error(`Failed to initialize async backend: ${type}`)
58 }
59
60 return cachedBackend
61}
62
63/**
64 * Gets the current backend type (for logging/debugging)

Callers 11

dispatchDueDrainsFunction · 0.90
dispatcherStepFunction · 0.90
dispatchCleanupJobsFunction · 0.90
queueWebhookExecutionFunction · 0.90
route.tsFile · 0.90
handleAsyncExecutionFunction · 0.90
route.tsFile · 0.90
runScheduleTickFunction · 0.90
route.tsFile · 0.90
cancelWorkflowGroupRunsFunction · 0.85

Calls 2

getAsyncBackendTypeFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected