Skip to content

Commit

Permalink
Update unit tests to not rely on queue priority
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed May 5, 2024
1 parent cfcf386 commit dbb37e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Sources/Nuke/ImageTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public final class ImageTask: Hashable, CustomStringConvertible, @unchecked Send
lock = .allocate(capacity: 1)
lock.initialize(to: os_unfair_lock())

// Important to call it before `imageTaskStartCalled`
pipeline.delegate.imageTaskCreated(self, pipeline: pipeline)

task = Task {
try await withUnsafeThrowingContinuation { continuation in
self.withState { $0.continuation = continuation }
Expand Down
4 changes: 1 addition & 3 deletions Sources/Nuke/Pipeline/ImagePipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ public final class ImagePipeline: @unchecked Sendable {
// MARK: - ImageTask (Internal)

private func makeStartedImageTask(with request: ImageRequest, isDataTask: Bool = false, onEvent: ((ImageTask.Event, ImageTask) -> Void)? = nil) -> ImageTask {
let task = ImageTask(taskId: nextTaskId, request: request, isDataTask: isDataTask, pipeline: self, onEvent: onEvent)
delegate.imageTaskCreated(task, pipeline: self)
return task
ImageTask(taskId: nextTaskId, request: request, isDataTask: isDataTask, pipeline: self, onEvent: onEvent)
}

private func cancel(_ task: ImageTask) {
Expand Down

0 comments on commit dbb37e4

Please sign in to comment.