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

Function flushBatch

apps/sim/lib/billing/cleanup-dispatcher.ts:309–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307 if (isTriggerAvailable()) {
308 let batch: CleanupJobPayload[] = []
309 const flushBatch = async () => {
310 if (batch.length === 0) return
311 const currentBatch = batch
312 batch = []
313 const region = await resolveTriggerRegion()
314 const batchResult = await tasks.batchTrigger(
315 jobType,
316 currentBatch.map((payload) => ({
317 payload,
318 options: {
319 tags: [`plan:${payload.plan}`, `jobType:${jobType}`],
320 concurrencyKey: getCleanupConcurrencyKey(jobType),
321 region,
322 },
323 }))
324 )
325 jobIds.push(batchResult.batchId)
326 succeeded += currentBatch.length
327 }
328
329 const { chunkCount, workspaceCount } = await forEachCleanupChunk(jobType, async (payload) => {
330 batch.push(payload)

Callers 1

dispatchCleanupJobsFunction · 0.70

Calls 3

resolveTriggerRegionFunction · 0.90
getCleanupConcurrencyKeyFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected