parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
306 stars 69 forks source link

fix: add barrier for thread safety #348

Closed vdkdamian closed 2 years ago

vdkdamian commented 2 years ago

New Pull Request Checklist

Issue Description

This fixes an issue when downloading or uploading multiple items in ParseSwift that was caused by a thread-safety issue.

Related issue: #347

Approach

This PR adds a barrier to fix the related issue

TODOs before merging

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this pull request!

vdkdamian commented 2 years ago

@cbaker6 Why are the checks failing?

cbaker6 commented 2 years ago

@cbaker6 Why are the checks failing?

Not sure, maybe you can set break points on the failing tests and your changes to determine where the failures are coming from?

vdkdamian commented 2 years ago

Not sure, maybe you can set break points on the failing tests and your changes to determine where the failures are coming from?

I tested it in my app and it works perfectly, but the tests are failing.

It's coming from the test [ParseSwiftTests.ParseFileAsyncTests testFetchFileProgress].

Schermafbeelding 2022-03-03 om 19 32 34
codecov[bot] commented 2 years ago

Codecov Report

Merging #348 (a888b84) into main (675168e) will decrease coverage by 0.07%. The diff coverage is 62.10%.

@@            Coverage Diff             @@
##             main     #348      +/-   ##
==========================================
- Coverage   89.17%   89.09%   -0.08%     
==========================================
  Files         156      156              
  Lines       14553    14605      +52     
==========================================
+ Hits        12977    13013      +36     
- Misses       1576     1592      +16     
Impacted Files Coverage Δ
...urces/ParseSwift/API/ParseURLSessionDelegate.swift 12.67% <0.00%> (-3.12%) :arrow_down:
Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift 69.49% <67.56%> (+4.78%) :arrow_up:
Sources/ParseSwift/API/API+Command.swift 89.36% <100.00%> (+0.15%) :arrow_up:
Sources/ParseSwift/Extensions/URLSession.swift 78.63% <100.00%> (+1.46%) :arrow_up:
Sources/ParseSwift/Objects/ParseUser.swift 85.62% <0.00%> (-0.18%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cbaker6 commented 2 years ago

@vdkdamian can you try the latest branch in your code to see if you still run into the crash in your app?

vdkdamian commented 2 years ago

@vdkdamian can you try the latest branch in your code to see if you still run into the crash in your app?

Yes, the crash is back.

Schermafbeelding 2022-03-05 om 08 23 07
cbaker6 commented 2 years ago

Closing in favor of #394