Cleanup terminology

This commit is contained in:
Dominic Ferrando
2026-07-12 01:43:55 -04:00
parent 80f8962a3b
commit 8b81156f6c
4 changed files with 46 additions and 37 deletions
+3 -2
View File
@@ -59,7 +59,7 @@ class ProductSyncService {
retry: { limit: 3, delayMs: 10000 },
concurrency: { limit: 1, timeoutMs: 600000 }
},
handler: async (id, payload, setState) => {
processor: async (id, payload, setState) => {
await this.ProductSyncer.run({
filter: payload.filter,
beforeStep: async (pProductIds: number[]) => {
@@ -70,11 +70,12 @@ class ProductSyncService {
});
}
async getSessionSyncState(sessionId: string) {
async getLatestSyncState(sessionId: string) {
const latestSync = await db.selectFrom("events")
.select(["started_at", "ended_at", "has_failed", "state"])
.where("type", "=", ProductSyncService.EVENT_TYPE)
.where(sql<string>`payload->'session'->>'id'`, "=", sessionId)
.orderBy(sql`(started_at is not null and ended_at is null)`, "desc")
.orderBy("created_at", "desc")
.limit(1)
.executeTakeFirst();