Weekly Update 5 - Differential updates and caching

Progress

  • With the help of @laurent , I fixed the problem from last week by setting the parameter forceDevUpdateConfig from autoUpdater to true.
  • Added caching - updaterCacheDirName is a configuration option used in electron-builder to specify the name of the directory where update-related files (such as downloaded updates) are cached. This directory is used by the auto-updater to store downloaded update files before they are applied. I have named the directory joplin-update-cache.
  • Added differential updates - for differential updates to work, both the current version and the new version of the application need to have blockmap files.
    • Files required for differential updates to work: latest.yml, blockmaps of both versions (the current one and the new one), the full installer for the new version.
  • Added the logger from electron-log.
  • Now the notification will only be opened once, there will not be multiple instances, even if the checking period passes.

Process Flow for Differential Updates

  1. Check for Updates:
    • The updater checks if a new version is available by comparing the current version with the latest version info from the server.
  2. Download Blockmap Files:
    • If a new version is available, the updater downloads the blockmap files for both the old and new versions.
  3. Apply Differential Update:
    • The updater compares the old and new blockmap files to identify the differences.
    • It uses the old version installer file (cached locally) and the new version blockmap to apply only the changed parts.
    • This reduces the download size and speeds up the update process.
  4. Fallback to Full Download:
    • If the differential update fails (e.g., missing old version installer file), the updater falls back to downloading the entire new version installer.

Plans

Problems

  • I have the error Cannot download differentially, fallback to full download: Error: ENOENT: no such file or directory, open 'C:\Users\alice\AppData\Local\joplin-update-cache\installer.exe' . The installer for the current version is not cached, I have to investigate this. But the files mentions above are retrieved and compared.
  • This is from last week, I didn't manage to look over it yet: Right now, even if I close the application (or even uninstall it), the server still checks for updates, which I think is weird. I want to investigate this. It is not hard to solve it. On the dev environment this is not reproduced though.

I wonder if it would be possible to start creating some pull requests at this point? Possibly splitting them into self-contained PRs. The idea is to start releasing some code so that you don't have to release everything in one big PR at the end. That will be easier to review, and it allows us to suggest changes at an earlier stage.

For example differential updates or caching are nice to have, but more like something you can add later on once the rest of the feature is working.

Yes, I agree. Since the main functionality is working, I can create a PR to start integrating the base code, and then add other functionalities. I would like to also include differential updates in the first PR, but if I can't solve the problem this week, I will leave it for the second PR. Technically, I can push the code as it is (with the error), since the automatic updates will work regardless.

I think either this week or the next one I can integrate the code. I would also like to have smaller PRs than a big one. My plan is to integrate it before the first evaluation. I would also like to first ask for a friend's laptop to see if it works on Mac or if there are some problems...and then test on Linux.