@@ -235,7 +235,13 @@ public final class PostgresJobQueue: JobQueueDriver {
235
235
return Result . success ( QueuedJob ( id: jobId, jobBuffer: buffer) )
236
236
} catch {
237
237
try await self . setStatus ( jobId: jobId, status: . failed, connection: connection)
238
- return Result . failure ( JobQueueError . decodeJobFailed)
238
+ return Result . failure (
239
+ JobQueueError (
240
+ code: . decodeJobFailed,
241
+ jobName: nil ,
242
+ details: " \( String ( reflecting: error) ) "
243
+ )
244
+ )
239
245
}
240
246
}
241
247
}
@@ -276,12 +282,12 @@ public final class PostgresJobQueue: JobQueueDriver {
276
282
)
277
283
}
278
284
279
- func addToQueue( jobId: JobID , connection: PostgresConnection , delayUntil: Date ? ) async throws {
285
+ func addToQueue( jobId: JobID , connection: PostgresConnection , delayUntil: Date ) async throws {
280
286
// TODO: assign Date.now in swift-jobs options?
281
287
try await connection. query (
282
288
"""
283
289
INSERT INTO _hb_pg_job_queue (job_id, createdAt, delayed_until)
284
- VALUES ( \( jobId) , \( Date . now) , \( delayUntil ?? Date . now ) )
290
+ VALUES ( \( jobId) , \( Date . now) , \( delayUntil) )
285
291
-- We have found an existing job with the same id, SKIP this INSERT
286
292
ON CONFLICT (job_id) DO NOTHING
287
293
""" ,
@@ -327,7 +333,7 @@ public final class PostgresJobQueue: JobQueueDriver {
327
333
let jobs = try await getJobs ( withStatus: status)
328
334
self . logger. info ( " Moving \( jobs. count) jobs with status: \( status) to job queue " )
329
335
for jobId in jobs {
330
- try await self . addToQueue ( jobId: jobId, connection: connection, delayUntil: nil )
336
+ try await self . addToQueue ( jobId: jobId, connection: connection, delayUntil: Date . now )
331
337
}
332
338
333
339
case . doNothing:
0 commit comments