Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): potential race condition fix #3484

Merged
merged 23 commits into from
Jun 22, 2020
Merged

Conversation

russellwheatley
Copy link
Member

this may fix #2838. As noted in RN docs, the same dispatch queue instance has to be used: https://reactnative.dev/docs/native-modules-ios#threading

There's also some thread locking using the @synchronized directive courtesy of @Salakar. We're currently using the DISPATCH_QUEUE_SERIAL macro which at the very least fixes this problem. In the future, we might be able to leverage the @synchronized directive to make Realtime database calls concurrent using the DISPATCH_QUEUE_CONCURRENT macro. This would help boost performance.

However, this PR is aimed at the bugs stemming from issue #2838.

Summary

Checklist

  • Supports Android
  • Supports iOS
  • e2e tests added or updated in packages/**/e2e
  • Flow types updated
  • Typescript types updated

Test Plan

Release Plan

[CATEGORY][type] [LOCATION] - Message


Think react-native-firebase is great? Please consider supporting the project with any of the below:

@russellwheatley russellwheatley requested review from Salakar and Ehesp and removed request for Ehesp and Salakar April 16, 2020 13:52
@russellwheatley russellwheatley changed the title @russell/realtime db race condition fix(database): potential race condition fix Apr 16, 2020
@codecov
Copy link

codecov bot commented May 5, 2020

Codecov Report

Merging #3484 into master will increase coverage by 21.67%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master    #3484       +/-   ##
===========================================
+ Coverage   35.02%   56.68%   +21.67%     
===========================================
  Files          26      108       +82     
  Lines         834     3432     +2598     
  Branches      194        0      -194     
===========================================
+ Hits          292     1945     +1653     
- Misses        408     1487     +1079     
+ Partials      134        0      -134     

@Salakar Salakar changed the title fix(database): potential race condition fix fix(database,ios): potential race condition fix May 6, 2020
Salakar
Salakar previously approved these changes Jun 22, 2020
Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
@Salakar
Copy link
Member

Salakar commented Jun 22, 2020

LGTM!

LGTM GIF

@Salakar Salakar changed the title fix(database,ios): potential race condition fix fix(ios): potential race condition fix Jun 22, 2020
@Salakar Salakar merged commit ca34cef into master Jun 22, 2020
@Salakar Salakar deleted the @russell/realtime-db-bug branch June 22, 2020 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔥Can't modify config objects after they are in use for FIRDatabaseReferences
3 participants