Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Start to implement a worker to replace SyncrhonizationService

Vincent Bourgmayer requested to merge 299-step-5-SyncService-as-worker into main

Description

Replace SynchronizatioNService by a long running worker: SyncWorker

Screenshots

Technical details

  • Use a Unique OneTime WorkRequest (SyncWorker) to replace SynchronizationService.
  • The SyncWorker trigger a notification to be able to run for more than 10 minutes. The notification does no sound. It display number of syncRequest submitted.
  • Upload, Download & Disable file sync on delete are executed synchronously with a SyncTask class (implementing Runnable): No more Listener.
  • SyncTask is run Asynchronously in SyncWorker thanks to a FixedThreadPoolExecutor with 2 thread.
  • update class package's organization a little (moving operation package to synchronization/syncTasks

Note: One point I dislike with Sync task : all the request queued are submit to the FixedThreadPoolExecutor at the same time. They are not polled one by one. But they're still executed on 2 thread like before.

to Reviewer:

  • Please check and help about "LateInit var". I'm not use to this keyword and I'm sure there is things to correct/improve in implementation
  • Sorry for the commit history. I had difficulties to find and implement a working solution for this issue.

Tests

  • Sync Worker run longer than 10 minutes (10 minutes is the limit for classical worker)
  • Sync Big files
  • Cut network connection and check that it can restart later
  • Download file
  • Upload file
  • Disable File sync (on file delete)
  • Run without persistent flag
  • Sync is stopped when an account is removed

Maximum number of files synchronized in a single worker's run: 35 (various size)

Issues

https://gitlab.e.foundation/e/os/backlog/-/work_items/1699

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Edited by Vincent Bourgmayer

Merge request reports

Loading