@@ -134,12 +134,14 @@ function shouldImportInBackground(record: { name: string; size: number }): boole
134134async function dispatchImportJob ( payload : TableImportPayload ) : Promise < void > {
135135 if ( isTriggerDevEnabled ) {
136136 try {
137- const [ { tableImportTask } , { tasks } ] = await Promise . all ( [
137+ const [ { tableImportTask } , { tasks } , { resolveTriggerRegion } ] = await Promise . all ( [
138138 import ( '@/background/table-import' ) ,
139139 import ( '@trigger.dev/sdk' ) ,
140+ import ( '@/lib/core/async-jobs/region' ) ,
140141 ] )
141142 await tasks . trigger < typeof tableImportTask > ( 'table-import' , payload , {
142143 tags : [ `tableId:${ payload . tableId } ` , `jobId:${ payload . importId } ` ] ,
144+ region : await resolveTriggerRegion ( ) ,
143145 } )
144146 } catch ( error ) {
145147 await releaseJobClaim ( payload . tableId , payload . importId ) . catch ( ( ) => { } )
@@ -166,14 +168,15 @@ async function dispatchDeleteJob(params: {
166168 const { jobId, tableId, workspaceId, filter, cutoff, maxRows } = params
167169 if ( isTriggerDevEnabled ) {
168170 try {
169- const [ { tableDeleteTask } , { tasks } ] = await Promise . all ( [
171+ const [ { tableDeleteTask } , { tasks } , { resolveTriggerRegion } ] = await Promise . all ( [
170172 import ( '@/background/table-delete' ) ,
171173 import ( '@trigger.dev/sdk' ) ,
174+ import ( '@/lib/core/async-jobs/region' ) ,
172175 ] )
173176 await tasks . trigger < typeof tableDeleteTask > (
174177 'table-delete' ,
175178 { jobId, tableId, workspaceId, filter, cutoff : cutoff . toISOString ( ) , maxRows } ,
176- { tags : [ `tableId:${ tableId } ` , `jobId:${ jobId } ` ] }
179+ { tags : [ `tableId:${ tableId } ` , `jobId:${ jobId } ` ] , region : await resolveTriggerRegion ( ) }
177180 )
178181 } catch ( error ) {
179182 await releaseJobClaim ( tableId , jobId ) . catch ( ( ) => { } )
@@ -208,14 +211,15 @@ async function dispatchUpdateJob(params: {
208211 const { jobId, tableId, workspaceId, filter, data, cutoff, maxRows } = params
209212 if ( isTriggerDevEnabled ) {
210213 try {
211- const [ { tableUpdateTask } , { tasks } ] = await Promise . all ( [
214+ const [ { tableUpdateTask } , { tasks } , { resolveTriggerRegion } ] = await Promise . all ( [
212215 import ( '@/background/table-update' ) ,
213216 import ( '@trigger.dev/sdk' ) ,
217+ import ( '@/lib/core/async-jobs/region' ) ,
214218 ] )
215219 await tasks . trigger < typeof tableUpdateTask > (
216220 'table-update' ,
217221 { jobId, tableId, workspaceId, filter, data, cutoff : cutoff . toISOString ( ) , maxRows } ,
218- { tags : [ `tableId:${ tableId } ` , `jobId:${ jobId } ` ] }
222+ { tags : [ `tableId:${ tableId } ` , `jobId:${ jobId } ` ] , region : await resolveTriggerRegion ( ) }
219223 )
220224 } catch ( error ) {
221225 await releaseJobClaim ( tableId , jobId ) . catch ( ( ) => { } )
0 commit comments