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

Desktop: Seamless-Updates - creation of auto updater service #10772

Merged
merged 8 commits into from
Jul 28, 2024

Conversation

AliceHincu
Copy link
Contributor

@AliceHincu AliceHincu commented Jul 21, 2024

This PR contains the Auto Updater Service. The service will only log the update events and will not download or install the updates (for now). This way, this PR's code can monitor the availability of updates through the logs without triggering any update process.

Events that are logged:

  • checking for updates
  • an update is available/not available
  • an error occured in the process of auto updates
  • download of updates is in progress
  • update was downloaded

Copy link
Owner

@laurent22 laurent22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alice, that looks good, I've just left a few comments

@@ -0,0 +1,120 @@
import { app, BrowserWindow } from 'electron';
import { autoUpdater, UpdateInfo } from 'electron-updater';
import log from 'electron-log';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible please use our Logger class, so that log statements are sent to the expected file. Have a look how it's done in other files, but the pattern basically is const logger = Logger.create('AutoUpdaterService')

import { autoUpdater, UpdateInfo } from 'electron-updater';
import log from 'electron-log';
import path = require('path');
import { setInterval } from 'timers';
Copy link
Owner

@laurent22 laurent22 Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use shim.setInterval if possible - the reason is that it's going to use a more reliable timer and it's also easier to track all timers in the app.

Comment on lines 17 to 18
const DEFAULT_UPDATE_INTERVAL = 12 * 60 * 60 * 1000;
const INITIAL_UPDATE_STARTUP = 5 * 1000;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laurent22
Copy link
Owner

Thanks Alice, let's merge this!

@laurent22 laurent22 merged commit a6d6e70 into laurent22:dev Jul 28, 2024
10 checks passed
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.

2 participants