Skip to content

Commit b64f334

Browse files
committed
Move JobCleanup between files
1 parent 3c0c8a1 commit b64f334

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

Sources/JobsPostgres/PostgresJobsQueue+cleanup.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ public struct JobCleanupParameters: Sendable & Codable {
3838
}
3939

4040
extension PostgresJobQueue {
41+
/// what to do with failed/processing jobs from last time queue was handled
42+
public struct JobCleanup: Sendable, Codable {
43+
enum RawValue: Codable {
44+
case doNothing
45+
case rerun
46+
case remove(maxAge: Duration?)
47+
}
48+
let rawValue: RawValue
49+
50+
public static var doNothing: Self { .init(rawValue: .doNothing) }
51+
public static var rerun: Self { .init(rawValue: .rerun) }
52+
public static var remove: Self { .init(rawValue: .remove(maxAge: nil)) }
53+
public static func remove(maxAge: Duration) -> Self { .init(rawValue: .remove(maxAge: maxAge)) }
54+
}
55+
4156
/// clean up job name.
4257
///
4358
/// Use this with the ``JobSchedule`` to schedule a cleanup of

Sources/JobsPostgres/PostgresJobsQueue.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ import PostgresNIO
4545
public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, ResumableJobQueue {
4646

4747
public typealias JobID = UUID
48-
/// what to do with failed/processing jobs from last time queue was handled
49-
public struct JobCleanup: Sendable, Codable {
50-
enum RawValue: Codable {
51-
case doNothing
52-
case rerun
53-
case remove(maxAge: Duration?)
54-
}
55-
let rawValue: RawValue
56-
57-
public static var doNothing: Self { .init(rawValue: .doNothing) }
58-
public static var rerun: Self { .init(rawValue: .rerun) }
59-
public static var remove: Self { .init(rawValue: .remove(maxAge: nil)) }
60-
public static func remove(maxAge: Duration) -> Self { .init(rawValue: .remove(maxAge: maxAge)) }
61-
}
6248

6349
/// Job priority from lowest to highest
6450
public struct JobPriority: Equatable, Sendable {

0 commit comments

Comments
 (0)