MCPcopy
hub / github.com/Dokploy/dokploy / fetchDeploymentJobs

Function fetchDeploymentJobs

apps/api/src/service.ts:209–239  ·  view source on GitHub ↗
(
	serverId: string,
)

Source from the content-addressed store, hash-verified

207
208/** Fetch deployment jobs for a server: events → runs → rows (correct model: runs = jobs) */
209export const fetchDeploymentJobs = async (
210 serverId: string,
211): Promise<DeploymentJobRow[]> => {
212 if (!signingKey) {
213 logger.warn("INNGEST_SIGNING_KEY not set, returning empty jobs list");
214 return [];
215 }
216 if (!baseUrl) {
217 throw new Error("INNGEST_BASE_URL is required to list deployment jobs");
218 }
219
220 const events = await fetchInngestEvents();
221
222 const requestedForServer = events.filter(
223 (e) =>
224 e.name === "deployment/requested" &&
225 (e.data as Record<string, unknown>)?.serverId === serverId,
226 );
227 // Limit to avoid too many run fetches
228 const toFetch = requestedForServer.slice(0, 50);
229 const runsByEventId = new Map<string, InngestRun[]>();
230
231 await Promise.all(
232 toFetch.map(async (ev) => {
233 const runs = await fetchInngestRunsForEvent(ev.id);
234 runsByEventId.set(ev.id, runs);
235 }),
236 );
237
238 return buildDeploymentRowsFromRuns(toFetch, runsByEventId, serverId);
239};

Callers 1

index.tsFile · 0.85

Calls 3

fetchInngestEventsFunction · 0.85
fetchInngestRunsForEventFunction · 0.85

Tested by

no test coverage detected