Make sure only one sync job is running at a time
Before running sync worker, check if another sync worker is already running. Before in theory 2 sync jobs could run and potentially mess with each other (maybe leads to https://github.com/nextcloud/android/issues/11974)
- [X] Tests written, or not not needed
Problem: With current implementation when periodic sync worker is started and immediate filesync is already running because of changed files it will skip periodic sync which is not intended... But it is really unlikely since immediate file sync with changed files should only run for under 1 sec.
Codacy
Lint
| Type | master | PR |
| Warnings | 72 | 72 |
| Errors | 3 | 3 |
SpotBugs
| Category | Base | New |
|---|---|---|
| Bad practice | 66 | 66 |
| Correctness | 73 | 73 |
| Dodgy code | 349 | 349 |
| Experimental | 1 | 1 |
| Internationalization | 7 | 7 |
| Malicious code vulnerability | 2 | 2 |
| Multithreaded correctness | 6 | 6 |
| Performance | 57 | 57 |
| Security | 19 | 19 |
| Total | 580 | 580 |
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12372.apk
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.