Skip to content

Commit 34a9197

Browse files
authored
Use dedicated queue for Storage uploads and downloads instead of global queue (#10492)
1 parent 9266758 commit 34a9197

8 files changed

+17
-13
lines changed

FirebaseStorage/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 10.3.0
2+
- [fixed] Use dedicated queue for Storage uploads and downloads instead of global queue. Fixes regression
3+
introduced in 10.0.0. (#10487)
4+
15
# 10.2.0
26
- [fixed] Fixed an issue where using Storage with more than one FirebaseApp instance caused non-default Storage instances to deadlock (#10463).
37
- [fixed] Fixed a race condition where a download size could exceed the value of the `maxSize` parameter. (#10358)

FirebaseStorage/Sources/Internal/StorageDeleteTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal class StorageDeleteTask: StorageTask, StorageTaskManagement {
4545
*/
4646
internal func enqueue() {
4747
weak var weakSelf = self
48-
DispatchQueue.global(qos: .background).async {
48+
dispatchQueue.async {
4949
guard let strongSelf = weakSelf else { return }
5050
strongSelf.state = .queueing
5151
var request = strongSelf.baseRequest

FirebaseStorage/Sources/Internal/StorageGetDownloadURLTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal class StorageGetDownloadURLTask: StorageTask, StorageTaskManagement {
4545
*/
4646
internal func enqueue() {
4747
weak var weakSelf = self
48-
DispatchQueue.global(qos: .background).async {
48+
dispatchQueue.async {
4949
guard let strongSelf = weakSelf else { return }
5050
var request = strongSelf.baseRequest
5151
request.httpMethod = "GET"

FirebaseStorage/Sources/Internal/StorageGetMetadataTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal class StorageGetMetadataTask: StorageTask, StorageTaskManagement {
4545
*/
4646
internal func enqueue() {
4747
weak var weakSelf = self
48-
DispatchQueue.global(qos: .background).async {
48+
dispatchQueue.async {
4949
guard let strongSelf = weakSelf else { return }
5050
strongSelf.state = .queueing
5151
var request = strongSelf.baseRequest

FirebaseStorage/Sources/Internal/StorageListTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal class StorageListTask: StorageTask, StorageTaskManagement {
6464
*/
6565
internal func enqueue() {
6666
weak var weakSelf = self
67-
DispatchQueue.global(qos: .background).async {
67+
dispatchQueue.async {
6868
guard let strongSelf = weakSelf else { return }
6969
var queryParams = [String: String]()
7070

FirebaseStorage/Sources/Internal/StorageUpdateMetadataTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal class StorageUpdateMetadataTask: StorageTask, StorageTaskManagement {
4848
*/
4949
internal func enqueue() {
5050
weak var weakSelf = self
51-
DispatchQueue.global(qos: .background).async {
51+
dispatchQueue.async {
5252
guard let strongSelf = weakSelf else { return }
5353
var request = strongSelf.baseRequest
5454
let updateDictionary = strongSelf.updateMetadata.updatedMetadata()

FirebaseStorage/Sources/StorageDownloadTask.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ open class StorageDownloadTask: StorageObservableTask, StorageTaskManagement {
4444
*/
4545
@objc open func pause() {
4646
weak var weakSelf = self
47-
DispatchQueue.global(qos: .background).async {
47+
dispatchQueue.async {
4848
guard let strongSelf = weakSelf else { return }
4949
if strongSelf.state == .paused || strongSelf.state == .pausing {
5050
return
@@ -77,7 +77,7 @@ open class StorageDownloadTask: StorageObservableTask, StorageTaskManagement {
7777
*/
7878
@objc open func resume() {
7979
weak var weakSelf = self
80-
DispatchQueue.global(qos: .background).async {
80+
dispatchQueue.async {
8181
weakSelf?.state = .resuming
8282
if let snapshot = weakSelf?.snapshot {
8383
weakSelf?.fire(for: .resume, snapshot: snapshot)
@@ -106,7 +106,7 @@ open class StorageDownloadTask: StorageObservableTask, StorageTaskManagement {
106106

107107
internal func enqueueImplementation(resumeWith resumeData: Data? = nil) {
108108
weak var weakSelf = self
109-
DispatchQueue.global(qos: .background).async {
109+
dispatchQueue.async {
110110
guard let strongSelf = weakSelf else { return }
111111
strongSelf.state = .queueing
112112
var request = strongSelf.baseRequest
@@ -188,7 +188,7 @@ open class StorageDownloadTask: StorageObservableTask, StorageTaskManagement {
188188

189189
internal func cancel(withError error: NSError) {
190190
weak var weakSelf = self
191-
DispatchQueue.global(qos: .background).async {
191+
dispatchQueue.async {
192192
weakSelf?.state = .cancelled
193193
weakSelf?.fetcher?.stopFetching()
194194
weakSelf?.error = error

FirebaseStorage/Sources/StorageUploadTask.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import Foundation
3737
*/
3838
@objc open func enqueue() {
3939
weak var weakSelf = self
40-
DispatchQueue.global(qos: .background).async {
40+
dispatchQueue.async {
4141
guard let strongSelf = weakSelf else { return }
4242
if let contentValidationError = strongSelf.contentUploadError() {
4343
strongSelf.error = contentValidationError
@@ -148,7 +148,7 @@ import Foundation
148148
*/
149149
@objc open func pause() {
150150
weak var weakSelf = self
151-
DispatchQueue.global(qos: .background).async {
151+
dispatchQueue.async {
152152
weakSelf?.state = .paused
153153
weakSelf?.uploadFetcher?.pauseFetching()
154154
if weakSelf?.state != .success {
@@ -165,7 +165,7 @@ import Foundation
165165
*/
166166
@objc open func cancel() {
167167
weak var weakSelf = self
168-
DispatchQueue.global(qos: .background).async {
168+
dispatchQueue.async {
169169
weakSelf?.state = .cancelled
170170
weakSelf?.uploadFetcher?.stopFetching()
171171
if weakSelf?.state != .success {
@@ -186,7 +186,7 @@ import Foundation
186186
*/
187187
@objc open func resume() {
188188
weak var weakSelf = self
189-
DispatchQueue.global(qos: .background).async {
189+
dispatchQueue.async {
190190
weakSelf?.state = .resuming
191191
weakSelf?.uploadFetcher?.resumeFetching()
192192
if weakSelf?.state != .success {

0 commit comments

Comments
 (0)