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

Function dispatchDeleteJob

apps/sim/lib/copilot/tools/server/table/user-table.ts:160–195  ·  view source on GitHub ↗

* Dispatches a background filter-delete for an already-claimed job slot, * mirroring the delete-async route. Same release-on-failed-dispatch guard as * dispatchImportJob.

(params: {
  jobId: string
  tableId: string
  workspaceId: string
  filter: Filter
  cutoff: Date
  maxRows?: number
})

Source from the content-addressed store, hash-verified

158 * {@link dispatchImportJob}.
159 */
160async function dispatchDeleteJob(params: {
161 jobId: string
162 tableId: string
163 workspaceId: string
164 filter: Filter
165 cutoff: Date
166 maxRows?: number
167}): Promise<void> {
168 const { jobId, tableId, workspaceId, filter, cutoff, maxRows } = params
169 if (isTriggerDevEnabled) {
170 try {
171 const [{ tableDeleteTask }, { tasks }, { resolveTriggerRegion }] = await Promise.all([
172 import('@/background/table-delete'),
173 import('@trigger.dev/sdk'),
174 import('@/lib/core/async-jobs/region'),
175 ])
176 await tasks.trigger<typeof tableDeleteTask>(
177 'table-delete',
178 { jobId, tableId, workspaceId, filter, cutoff: cutoff.toISOString(), maxRows },
179 { tags: [`tableId:${tableId}`, `jobId:${jobId}`], region: await resolveTriggerRegion() }
180 )
181 } catch (error) {
182 await releaseJobClaim(tableId, jobId).catch(() => {})
183 throw error
184 }
185 } else {
186 runDetached('table-delete', () =>
187 runTableDelete({ jobId, tableId, workspaceId, filter, cutoff, maxRows }).catch(
188 async (error) => {
189 await markTableDeleteFailed(tableId, jobId, error)
190 throw error
191 }
192 )
193 )
194 }
195}
196
197/**
198 * Dispatches a background bulk update for an already-claimed job slot, mirroring

Callers 1

executeFunction · 0.85

Calls 5

releaseJobClaimFunction · 0.90
runDetachedFunction · 0.90
runTableDeleteFunction · 0.90
markTableDeleteFailedFunction · 0.90
resolveTriggerRegionFunction · 0.85

Tested by

no test coverage detected