From d2388b1726e4364cdfaf4ab5be778b2d86e5f644 Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Thu, 24 Oct 2024 02:19:34 -0500 Subject: [PATCH 1/2] Add an "initial" state to jobs to avoid race conditions between the set() and push() queue operations. Fixes #13 --- Sources/QueuesFluentDriver/FluentQueue.swift | 2 +- Sources/QueuesFluentDriver/JobModel.swift | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/QueuesFluentDriver/FluentQueue.swift b/Sources/QueuesFluentDriver/FluentQueue.swift index 0eec3d0..83c615f 100644 --- a/Sources/QueuesFluentDriver/FluentQueue.swift +++ b/Sources/QueuesFluentDriver/FluentQueue.swift @@ -38,7 +38,7 @@ public struct FluentQueue: AsyncQueue, Sendable { .bind(jobStorage.jobName), .bind(jobStorage.queuedAt), .bind(jobStorage.delayUntil), - .literal(StoredJobState.pending), + .literal(StoredJobState.initial), .bind(jobStorage.maxRetryCount), .bind(jobStorage.attempts), .bind(Data(jobStorage.payload)), diff --git a/Sources/QueuesFluentDriver/JobModel.swift b/Sources/QueuesFluentDriver/JobModel.swift index 9f5186e..ac29a5b 100644 --- a/Sources/QueuesFluentDriver/JobModel.swift +++ b/Sources/QueuesFluentDriver/JobModel.swift @@ -6,6 +6,9 @@ import struct Queues.QueueName /// The state of a job currently stored in the database. enum StoredJobState: String, Codable, CaseIterable { + /// Job has been set up but is not yet ready to execute. + case initial + /// Job is ready to be picked up for execution. case pending From 439ab86da8e9c46be8244a5850f5d4b2801c3dab Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Thu, 24 Oct 2024 02:23:11 -0500 Subject: [PATCH 2/2] Update CI --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f776667..793112f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,10 +57,10 @@ jobs: fail-fast: false matrix: include: - - macos-version: macos-13 - xcode-version: '~15.2' - macos-version: macos-14 xcode-version: latest-stable + - macos-version: macos-15 + xcode-version: latest-stable runs-on: ${{ matrix.macos-version }} timeout-minutes: 60 steps: