Skip to content

Commit a4d35d4

Browse files
committed
Fix up cancellable job test
1 parent aa0dc32 commit a4d35d4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/JobsPostgres/PostgresJobsQueue.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
200200
try await deleteFromQueue(jobID: jobID, connection: connection)
201201
if configuration.deleteCancelledJobs {
202202
try await delete(jobID: jobID)
203-
return
203+
} else {
204+
try await setStatus(jobID: jobID, status: .cancelled, connection: connection)
204205
}
205-
try await setStatus(jobID: jobID, status: .cancelled, connection: connection)
206206
}
207207
}
208208

Tests/JobsPostgresTests/JobsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ final class JobsTests: XCTestCase {
794794
}
795795

796796
await fulfillment(of: [expectation], timeout: 10)
797-
797+
// Job has been removed
798798
let cancelledJobs = try await jobQueue.queue.getJobs(withStatus: .cancelled)
799-
XCTAssertEqual(cancelledJobs.count, 1)
799+
XCTAssertEqual(cancelledJobs.count, 0)
800800

801801
await serviceGroup.triggerGracefulShutdown()
802802

0 commit comments

Comments
 (0)