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

Function updateWorkflowRunCounts

apps/sim/lib/workflows/utils.ts:251–276  ·  view source on GitHub ↗
(workflowId: string, runs = 1)

Source from the content-addressed store, hash-verified

249}
250
251export async function updateWorkflowRunCounts(workflowId: string, runs = 1) {
252 try {
253 const workflow = await getWorkflowById(workflowId)
254 if (!workflow) {
255 logger.error(`Workflow ${workflowId} not found`)
256 throw new Error(`Workflow ${workflowId} not found`)
257 }
258
259 await db
260 .update(workflowTable)
261 .set({
262 runCount: workflow.runCount + runs,
263 lastRunAt: new Date(),
264 })
265 .where(eq(workflowTable.id, workflowId))
266
267 return {
268 success: true,
269 runsAdded: runs,
270 newTotal: workflow.runCount + runs,
271 }
272 } catch (error) {
273 logger.error(`Error updating workflow stats for ${workflowId}`, error)
274 throw error
275 }
276}
277
278export const workflowHasResponseBlock = (
279 executionResult: Pick<ExecutionResult, 'success' | 'logs'>

Callers 1

executeWorkflowCoreFunction · 0.90

Calls 4

errorMethod · 0.80
getWorkflowByIdFunction · 0.70
setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected