Skip to content

Commit 7639421

Browse files
committed
Move Retention policy inside PostgresJobQueue
1 parent a98f6b5 commit 7639421

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

Sources/JobsPostgres/PostgresJobsQueue+cleanup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension PostgresJobQueue {
5858
/// Use this with the ``JobSchedule`` to schedule a cleanup of
5959
/// failed, cancelled or completed jobs
6060
public var cleanupJob: JobName<JobCleanupParameters> {
61-
.init("_JobCleanup_\(self.configuration.queueName)")
61+
.init("_Jobs_PostgresCleanup_\(self.configuration.queueName)")
6262
}
6363

6464
/// register clean up job on queue

Sources/JobsPostgres/RetentionPolicy.swift

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,38 @@
1414

1515
import Foundation
1616

17-
/// Data rentension policy
18-
public struct RetentionPolicy: Sendable {
19-
/// Data retention policy
20-
public struct RetainData: Equatable, Sendable {
21-
enum Policy {
22-
case retain
23-
case doNotRetain
24-
}
17+
extension PostgresJobQueue {
18+
/// Data rentension policy
19+
public struct RetentionPolicy: Sendable {
20+
/// Data retention policy
21+
public struct RetainData: Equatable, Sendable {
22+
enum Policy {
23+
case retain
24+
case doNotRetain
25+
}
2526

26-
let rawValue: Policy
27-
/// Retain task
28-
public static var retain: RetainData { RetainData(rawValue: .retain) }
29-
/// Never retain any data
30-
public static var doNotRetain: RetainData { RetainData(rawValue: .doNotRetain) }
31-
}
27+
let rawValue: Policy
28+
/// Retain task
29+
public static var retain: RetainData { RetainData(rawValue: .retain) }
30+
/// Never retain any data
31+
public static var doNotRetain: RetainData { RetainData(rawValue: .doNotRetain) }
32+
}
3233

33-
/// Jobs with status cancelled
34-
public var cancelled: RetainData
35-
/// Jobs with status completed
36-
public var completed: RetainData
37-
/// Jobs with status failed
38-
public var failed: RetainData
34+
/// Jobs with status cancelled
35+
public var cancelled: RetainData
36+
/// Jobs with status completed
37+
public var completed: RetainData
38+
/// Jobs with status failed
39+
public var failed: RetainData
3940

40-
public init(
41-
cancelled: RetainData = .doNotRetain,
42-
completed: RetainData = .doNotRetain,
43-
failed: RetainData = .retain
44-
) {
45-
self.cancelled = cancelled
46-
self.completed = completed
47-
self.failed = failed
41+
public init(
42+
cancelled: RetainData = .doNotRetain,
43+
completed: RetainData = .doNotRetain,
44+
failed: RetainData = .retain
45+
) {
46+
self.cancelled = cancelled
47+
self.completed = completed
48+
self.failed = failed
49+
}
4850
}
4951
}

0 commit comments

Comments
 (0)