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 "share log" error due to leftover loggerDB tmp file #1197

Merged
merged 2 commits into from
Feb 17, 2025

Conversation

JGreenlee
Copy link
Collaborator

@JGreenlee JGreenlee commented Feb 14, 2025

e-mission/e-mission-docs#1110

After sharing the tmp DB file, we try to clear it, but if this operation fails or the app exits before we get to this, for any reason, all subsequent attempts to share the DB file would fail with error 12 PATH_EXISTS_ERR
A simple solution is to attempt to clear the tmp file before and after sharing.

I also changed this to async/await syntax to make it clearer what is happening.

Testing done:

I ran a dev build of emission on an Android test phone. From profile I clicked Share log and saw tmp file did not exist, that is fine... in the console.
The share menu came up, but before dismissing it I went into app settings and Force Quit the app. This caused a leftover tmp file that was not cleared. (I never saw Successfully cleaned up file loggerDB in the console)

Then I launched the app again and repeated the same steps. This time I saw Successfully cleaned up file... in the console. The user-visible behavior was the same (share menu popped up). This time I allowed the share menu to dismiss and I saw Successfully cleaned up file loggerDB again

e-mission/e-mission-docs#1110

After sharing the tmp DB file, we try to clear it, but if this operation fails or the app exits before we get to this, for any reason, all subsequent attempts to share the DB file would fail with error 12 (PATH_EXISTS_ERR)
A simple solution is to attempt to clear the tmp file before *and* after sharing.

I also changed this to async/await syntax to make it clearer what is happening.

Testing done:

I ran a dev build of emission on an Android test phone. From profile I clicked Share log and saw the "tmp file did not exist, that is fine..." log
The share menu came up but before dismissing it I went into app settings and Force Quit the app.
This caused a leftover tmp file that was not cleared. (I never saw "Successfully cleaned up file loggerDB" in the console)

Then I launched the app again and repeated the same steps. This time I saw "Successfully cleaned up file..." in the console. The user-visible behavior was the same (share menu popped up). After allowing the share menu to dismiss, I saw "Successfully cleaned up file loggerDB" again
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 56 lines in your changes missing coverage. Please review.

Project coverage is 29.76%. Comparing base (df131c4) to head (cce8b91).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
www/js/services/shareLocalDBFile.ts 0.00% 56 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1197      +/-   ##
==========================================
- Coverage   29.78%   29.76%   -0.03%     
==========================================
  Files         123      123              
  Lines        4955     4959       +4     
  Branches     1139     1096      -43     
==========================================
  Hits         1476     1476              
- Misses       3477     3483       +6     
+ Partials        2        0       -2     
Flag Coverage Δ
unit 29.76% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
www/js/services/shareLocalDBFile.ts 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

@shankari shankari merged commit 001cc0b into master Feb 17, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tasks completed
Development

Successfully merging this pull request may close these issues.

2 participants