diff --git a/apps/api/src/server.ts b/apps/api/src/server.ts index 006b63d..9f6fd74 100644 --- a/apps/api/src/server.ts +++ b/apps/api/src/server.ts @@ -261,9 +261,9 @@ export const app = new Elysia() }, { params: t.Object({ id: t.String() }) }) - .post("/:id/replay", async ({ params: { id } }) => { - const replayed = await s.Events.replay(id); - if (!replayed) throw new NotFoundError("Event not found or not in a failed state"); + .post("/:id/retry", async ({ params: { id } }) => { + const retried = await s.Events.retry(id); + if (!retried) throw new NotFoundError("Event not found or not in a failed state"); }, { params: t.Object({ id: t.String() }) }) diff --git a/apps/api/src/services/event-queue.ts b/apps/api/src/services/event-queue.ts index b3f371b..3114fbd 100644 --- a/apps/api/src/services/event-queue.ts +++ b/apps/api/src/services/event-queue.ts @@ -206,7 +206,7 @@ export class EventQueue ({ errors: type === "error" ? eb("errors", "+", 1) : eb.ref("errors"), diff --git a/apps/api/src/services/events.ts b/apps/api/src/services/events.ts index 60f7cc5..9a91886 100644 --- a/apps/api/src/services/events.ts +++ b/apps/api/src/services/events.ts @@ -122,7 +122,7 @@ export class EventsService { .execute(); } - async replay(id: string): Promise { + async retry(id: string): Promise { const result = await db.updateTable("events") .set({ started_at: null, diff --git a/apps/portal/src/routes/(app)/activity/events/+page.svelte b/apps/portal/src/routes/(app)/activity/events/+page.svelte index ba4c9d9..5d900f8 100644 --- a/apps/portal/src/routes/(app)/activity/events/+page.svelte +++ b/apps/portal/src/routes/(app)/activity/events/+page.svelte @@ -25,7 +25,7 @@ let offset = $state(0); let group = $state(""); let status = $state(""); - let replayingIds = $state([]); + let retryingIds = $state([]); function errorMessage(err: unknown): string { const value = (err as { value?: { error?: string } })?.value; @@ -37,7 +37,6 @@ function formatLabel(value: string): string { return value - .replace(/^apparel_/, "") .replace(/_/g, " ") .replace(/\b\w/g, (c) => c.toUpperCase()); } @@ -101,16 +100,16 @@ refresh(); } - async function replay(id: string) { - replayingIds = [...replayingIds, id]; + async function retry(id: string) { + retryingIds = [...retryingIds, id]; try { - const res = await api.events({ id }).replay.post(); + const res = await api.events({ id }).retry.post(); if (res.error) throw res.error; await refresh(); } catch (err) { loadError = errorMessage(err); } finally { - replayingIds = replayingIds.filter((x) => x !== id); + retryingIds = retryingIds.filter((x) => x !== id); } } @@ -232,12 +231,12 @@ {#if event.status === "failed"} {/if}