Skip to content

Commit 817ff2a

Browse files
committed
Swift format and code clean up
1 parent 45c3376 commit 817ff2a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Sources/JobsPostgres/PostgresJobsQueue.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
308308
)
309309
return insertedJobID
310310
}
311-
311+
312312
if insertedJob != jobID {
313313
// TODO: introduce a duplicate jobID error
314314
throw JobQueueError(code: .unrecognisedJobId, jobName: Parameters.jobName)
@@ -318,15 +318,15 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
318318

319319
/// Retry an existing Job
320320
/// - Parameters
321-
/// - id: Job instance ID
321+
/// - jobID: Job instance ID
322322
/// - jobRequest: Job Request
323323
/// - options: Job retry options
324-
public func retry<Parameters: JobParameters>(_ id: JobID, jobRequest: JobRequest<Parameters>, options: JobRetryOptions) async throws {
324+
public func retry<Parameters: JobParameters>(_ jobID: JobID, jobRequest: JobRequest<Parameters>, options: JobRetryOptions) async throws {
325325
let buffer = try self.jobRegistry.encode(jobRequest: jobRequest)
326326
try await self.client.withTransaction(logger: self.logger) { connection in
327-
try await self.updateJob(id: id, buffer: buffer, connection: connection)
327+
try await self.updateJob(jobID: jobID, buffer: buffer, connection: connection)
328328
try await self.addToQueue(
329-
jobID: id,
329+
jobID: jobID,
330330
queueName: configuration.queueName,
331331
options: .init(delayUntil: options.delayUntil),
332332
connection: connection
@@ -488,15 +488,15 @@ public final class PostgresJobQueue: JobQueueDriver, CancellableJobQueue, Resuma
488488
)
489489
return try await stream.decode(JobID.self).first(where: { _ in true })
490490
}
491-
// TODO: maybe add a new column colum for attempt so far after PR https://github.com/hummingbird-project/swift-jobs/pull/63 is merged?
492-
func updateJob(id: JobID, buffer: ByteBuffer, connection: PostgresConnection) async throws {
491+
492+
func updateJob(jobID: JobID, buffer: ByteBuffer, connection: PostgresConnection) async throws {
493493
try await connection.query(
494494
"""
495495
UPDATE swift_jobs.jobs
496496
SET job = \(buffer),
497497
last_modified = \(Date.now),
498498
status = \(Status.failed)
499-
WHERE id = \(id) AND queue_name = \(configuration.queueName)
499+
WHERE id = \(jobID) AND queue_name = \(configuration.queueName)
500500
""",
501501
logger: self.logger
502502
)

0 commit comments

Comments
 (0)