@@ -8,7 +8,7 @@ import { isOrganizationOnTeamOrEnterprisePlan } from '@/lib/billing/core/subscri
88import { getInlineJobQueue , getJobQueue } from '@/lib/core/async-jobs'
99import type { AsyncExecutionCorrelation } from '@/lib/core/async-jobs/types'
1010import { createBullMQJobData , isBullMQEnabled } from '@/lib/core/bullmq'
11- import { isProd } from '@/lib/core/config/feature-flags'
11+ import { isProd , isTriggerDevEnabled } from '@/lib/core/config/feature-flags'
1212import { safeCompare } from '@/lib/core/security/encryption'
1313import { enqueueWorkspaceDispatch } from '@/lib/core/workspace-dispatch'
1414import { getEffectiveDecryptedEnv } from '@/lib/environment/utils'
@@ -1265,9 +1265,16 @@ export async function queueWebhookExecution(
12651265
12661266 const isPolling = isPollingWebhookProvider ( payload . provider )
12671267
1268- if ( isPolling && isBullMQEnabled ( ) ) {
1269- const jobId = isBullMQEnabled ( )
1270- ? await enqueueWorkspaceDispatch ( {
1268+ if ( isPolling && ( isTriggerDevEnabled || isBullMQEnabled ( ) ) ) {
1269+ const jobId = isTriggerDevEnabled
1270+ ? await ( await getJobQueue ( ) ) . enqueue ( 'webhook-execution' , payload , {
1271+ metadata : {
1272+ workflowId : foundWorkflow . id ,
1273+ userId : actorUserId ,
1274+ correlation,
1275+ } ,
1276+ } )
1277+ : await enqueueWorkspaceDispatch ( {
12711278 id : executionId ,
12721279 workspaceId : foundWorkflow . workspaceId ,
12731280 lane : 'runtime' ,
@@ -1284,13 +1291,6 @@ export async function queueWebhookExecution(
12841291 correlation,
12851292 } ,
12861293 } )
1287- : await ( await getJobQueue ( ) ) . enqueue ( 'webhook-execution' , payload , {
1288- metadata : {
1289- workflowId : foundWorkflow . id ,
1290- userId : actorUserId ,
1291- correlation,
1292- } ,
1293- } )
12941294 logger . info (
12951295 `[${ options . requestId } ] Queued polling webhook execution task ${ jobId } for ${ foundWebhook . provider } webhook via job queue`
12961296 )
0 commit comments