Skip to content

Commit

Permalink
Merge again
Browse files Browse the repository at this point in the history
  • Loading branch information
ptoffy committed Aug 28, 2024
1 parent 07c06f6 commit faecb64
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions Sources/Queues/QueueWorker.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import Dispatch
import Foundation
import Logging
Expand Down
2 changes: 0 additions & 2 deletions Sources/XCTQueues/TestQueueDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ extension Application.Queues {
struct TestQueue: Queue {
let _context: NIOLockedValueBox<QueueContext>
var context: QueueContext { self._context.withLockedValue { $0 } }

func get(_ id: JobIdentifier) -> EventLoopFuture<JobData> {
self._context.withLockedValue { context in
context.eventLoop.makeSucceededFuture(context.application.queues.test.jobs[id]!)
Expand Down Expand Up @@ -149,7 +148,6 @@ struct TestQueue: Queue {
struct AsyncTestQueue: AsyncQueue {
let _context: NIOLockedValueBox<QueueContext>
var context: QueueContext { self._context.withLockedValue { $0 } }

func get(_ id: JobIdentifier) async throws -> JobData { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id]! } }
func set(_ id: JobIdentifier, to data: JobData) async throws { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id] = data } }
func clear(_ id: JobIdentifier) async throws { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id] = nil } }
Expand Down
1 change: 0 additions & 1 deletion Tests/QueuesTests/AsyncQueueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func XCTAssertNoThrowAsync<T>(

final class AsyncQueueTests: XCTestCase {
var app: Application!

override class func setUp() {
XCTAssert(isLoggingConfigured)
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/QueuesTests/MetricsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ final class MetricsTests: XCTestCase {
XCTAssertEqual(self.app.queues.test.jobs.count, 0)
XCTAssertEqual(dequeuedHook.successHit, true)

let counter = self.metrics.counters["success.completed.jobs.counter"] as! TestCounter
let counter = try XCTUnwrap(self.metrics.counters["success.completed.jobs.counter"] as? TestCounter)
let queueNameDimension = try XCTUnwrap(counter.dimensions.first(where: { $0.0 == "queueName" }))
XCTAssertEqual(queueNameDimension.1, self.app.queues.queue.queueName.string)
try XCTAssertNoThrow(promise.futureResult.wait())
Expand All @@ -102,7 +102,7 @@ final class MetricsTests: XCTestCase {

try self.app.queues.queue.worker.run().wait()

let counter = self.metrics.counters["dispatched.jobs.counter"] as! TestCounter
let counter = try XCTUnwrap(self.metrics.counters["dispatched.jobs.counter"] as? TestCounter)
let queueNameDimension = try XCTUnwrap(counter.dimensions.first(where: { $0.0 == "queueName" }))
XCTAssertEqual(queueNameDimension.1, self.app.queues.queue.queueName.string)
try XCTAssertNoThrow(promise.futureResult.wait())
Expand Down

0 comments on commit faecb64

Please sign in to comment.