Rename event fulfill to resolve
This commit is contained in:
@@ -179,7 +179,7 @@ export class EventQueue<G extends string, T extends Record<string, EventTypeOpti
|
|||||||
try {
|
try {
|
||||||
Value.Assert(cfg.schemas.payload, event.payload);
|
Value.Assert(cfg.schemas.payload, event.payload);
|
||||||
await cfg.processor(event.payload, (state) => this.Events.setState(event.id, state), event.id);
|
await cfg.processor(event.payload, (state) => this.Events.setState(event.id, state), event.id);
|
||||||
await this.Events.fulfill(event.id);
|
await this.Events.resolve(event.id);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
await this.Events.setLastError(event.id, err);
|
await this.Events.setLastError(event.id, err);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const EventStatusSchema = t.Union([
|
|||||||
t.Literal("available"),
|
t.Literal("available"),
|
||||||
t.Literal("processing"),
|
t.Literal("processing"),
|
||||||
t.Literal("failed"),
|
t.Literal("failed"),
|
||||||
t.Literal("fulfilled"),
|
t.Literal("resolved"),
|
||||||
]);
|
]);
|
||||||
export type EventStatus = Static<typeof EventStatusSchema>;
|
export type EventStatus = Static<typeof EventStatusSchema>;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export class EventsService {
|
|||||||
return "available";
|
return "available";
|
||||||
};
|
};
|
||||||
if (!event.ended_at) return "processing";
|
if (!event.ended_at) return "processing";
|
||||||
return event.has_failed ? "failed" : "fulfilled";
|
return event.has_failed ? "failed" : "resolved";
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(id: string, trx?: Transaction<DB>) {
|
async get(id: string, trx?: Transaction<DB>) {
|
||||||
@@ -76,7 +76,7 @@ export class EventsService {
|
|||||||
.where("ended_at", "is not", null)
|
.where("ended_at", "is not", null)
|
||||||
.where("has_failed", "is", true)
|
.where("has_failed", "is", true)
|
||||||
)
|
)
|
||||||
.$if(opt.filter?.status === "fulfilled", (qb) => qb
|
.$if(opt.filter?.status === "resolved", (qb) => qb
|
||||||
.where("started_at", "is not", null)
|
.where("started_at", "is not", null)
|
||||||
.where("ended_at", "is not", null)
|
.where("ended_at", "is not", null)
|
||||||
.where("has_failed", "is", false)
|
.where("has_failed", "is", false)
|
||||||
@@ -115,7 +115,7 @@ export class EventsService {
|
|||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
async fulfill(id: string, trx?: Transaction<DB>): Promise<void> {
|
async resolve(id: string, trx?: Transaction<DB>): Promise<void> {
|
||||||
await (trx ?? db).updateTable("events")
|
await (trx ?? db).updateTable("events")
|
||||||
.set({ state: null, ended_at: new Date(), last_error: null })
|
.set({ state: null, ended_at: new Date(), last_error: null })
|
||||||
.where("id", "=", id)
|
.where("id", "=", id)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
available: "badge-info",
|
available: "badge-info",
|
||||||
processing: "badge-warning",
|
processing: "badge-warning",
|
||||||
failed: "badge-error",
|
failed: "badge-error",
|
||||||
fulfilled: "badge-success",
|
resolved: "badge-success",
|
||||||
};
|
};
|
||||||
|
|
||||||
const groups = (await api.events.groups.get()).data ?? [];
|
const groups = (await api.events.groups.get()).data ?? [];
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
<option value="available">Available</option>
|
<option value="available">Available</option>
|
||||||
<option value="processing">Processing</option>
|
<option value="processing">Processing</option>
|
||||||
<option value="failed">Failed</option>
|
<option value="failed">Failed</option>
|
||||||
<option value="fulfilled">Fulfilled</option>
|
<option value="resolved">Resolved</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button class="btn btn-sm" onclick={refresh} disabled={loading}>
|
<button class="btn btn-sm" onclick={refresh} disabled={loading}>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
get isInProgress() {
|
get isInProgress() {
|
||||||
return (
|
return (
|
||||||
this.status !== "failed" &&
|
this.status !== "failed" &&
|
||||||
this.status !== "fulfilled" &&
|
this.status !== "resolved" &&
|
||||||
this.status !== "none"
|
this.status !== "none"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user