Skip to content

Commit b11bf67

Browse files
authored
Merge branch 'main' into ci
2 parents 94b9ba9 + ab3cbbf commit b11bf67

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

Sources/JobsPostgres/PostgresJobsQueue.swift

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,15 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
6565
case highest = 4
6666
}
6767
/// Lowest priority
68-
public static func lowest() -> JobPriority {
69-
JobPriority(rawValue: .lowest)
70-
}
68+
public static let lowest: JobPriority = JobPriority(rawValue: .lowest)
7169
/// Lower priority
72-
public static func lower() -> JobPriority {
73-
JobPriority(rawValue: .lower)
74-
}
70+
public static let lower: JobPriority = JobPriority(rawValue: .lower)
7571
/// Normal is the default priority
76-
public static func normal() -> JobPriority {
77-
JobPriority(rawValue: .normal)
78-
}
72+
public static let normal: JobPriority = JobPriority(rawValue: .normal)
7973
/// Higher priority
80-
public static func higher() -> JobPriority {
81-
JobPriority(rawValue: .higher)
82-
}
74+
public static let higher: JobPriority = JobPriority(rawValue: .higher)
8375
/// Higgest priority
84-
public static func highest() -> JobPriority {
85-
JobPriority(rawValue: .highest)
86-
}
76+
public static let highest: JobPriority = JobPriority(rawValue: .highest)
8777
}
8878

8979
/// Options for job pushed to queue
@@ -96,20 +86,20 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
9686
/// Default initializer for JobOptions
9787
public init() {
9888
self.delayUntil = .now
99-
self.priority = .normal()
89+
self.priority = .normal
10090
}
10191

10292
/// Initializer for JobOptions
10393
/// - Parameter delayUntil: Whether job execution should be delayed until a later date
10494
public init(delayUntil: Date?) {
10595
self.delayUntil = delayUntil ?? .now
106-
self.priority = .normal()
96+
self.priority = .normal
10797
}
10898

10999
/// Initializer for JobOptions
110100
/// - Parameter delayUntil: Whether job execution should be delayed until a later date
111101
/// - Parameter priority: The priority for a job
112-
public init(delayUntil: Date = .now, priority: JobPriority = .normal()) {
102+
public init(delayUntil: Date = .now, priority: JobPriority = .normal) {
113103
self.delayUntil = delayUntil
114104
self.priority = priority
115105
}

Tests/JobsPostgresTests/JobsTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,14 @@ final class JobsTests: XCTestCase {
278278
try await queue.push(
279279
TestParameters(value: 20),
280280
options: .init(
281-
priority: .lowest()
281+
priority: .lowest
282282
)
283283
)
284284

285285
try await queue.push(
286286
TestParameters(value: 2025),
287287
options: .init(
288-
priority: .highest()
288+
priority: .highest
289289
)
290290
)
291291

@@ -332,15 +332,15 @@ final class JobsTests: XCTestCase {
332332
try await queue.push(
333333
TestParameters(value: 20),
334334
options: .init(
335-
priority: .lower()
335+
priority: .lower
336336
)
337337
)
338338

339339
try await queue.push(
340340
TestParameters(value: 2025),
341341
options: .init(
342342
delayUntil: Date.now.addingTimeInterval(1),
343-
priority: .higher()
343+
priority: .higher
344344
)
345345
)
346346

@@ -717,14 +717,14 @@ final class JobsTests: XCTestCase {
717717
let resumableJob = try await queue.push(
718718
ResumableJob(),
719719
options: .init(
720-
priority: .lowest()
720+
priority: .lowest
721721
)
722722
)
723723

724724
try await queue.push(
725725
TestParameters(),
726726
options: .init(
727-
priority: .normal()
727+
priority: .normal
728728
)
729729
)
730730

@@ -793,14 +793,14 @@ final class JobsTests: XCTestCase {
793793
let cancellableJob = try await queue.push(
794794
TestParameters(value: 42),
795795
options: .init(
796-
priority: .lower()
796+
priority: .lower
797797
)
798798
)
799799

800800
try await queue.push(
801801
NoneCancelledJobParameters(value: 2025),
802802
options: .init(
803-
priority: .highest()
803+
priority: .highest
804804
)
805805
)
806806

0 commit comments

Comments
 (0)