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

Add ability to auto start sync after auto-update of electron app #261

Conversation

ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Mar 20, 2023

This PR adds ability to auto-start sync after the auto-update of the electron app. The idea is to have a configurable option (by default turned on) to force sync after the auto-update or DB migration due to changes in the DB schema, the aim is to bring data consistency after significant updates. But the user can turn the option off via the settings menu.


The flow:

  • in the user table, there's shouldNotSyncOnStartupAfterUpdate flag used to turn on/off the option
  • in the user table, there's isSyncOnStartupRequired flag used to request sync
  • if the auto-update or DB migration takes place, isSyncOnStartupRequired=true will be set
  • and then after sign-in for each user the sync will be force pushed
  • and then after sync isSyncOnStartupRequired=flase will be reset
  • for the electron app adds the ability to request sync via ipc channel for covering auto-update point

Basic changes:

  • adds ability to auto-start sync after the DB migration
  • adds ability to auto-start sync after the auto-update via ipc channel
  • adds v33 DB migration
  • adds corresponding test coverage
  • adds ability to turn on/off the option, for it should be used:
    • to get current state:
      • singIn request:
      {
        "method": "signIn",
        "auth": {
          "token": "f19ab177-29e7-4c58-bfa0-36e9707a6977"
        }
      }
      • signIn response:
      {
        "jsonrpc": "2.0",
        "result": {
          "email": "[email protected]",
          "isSubAccount": false,
          "token": "f19ab177-29e7-4c58-bfa0-36e9707a6977",
          "shouldNotSyncOnStartupAfterUpdate": false // the flag
        },
        "id": null
      }
    • to change the opt flag:
      • updateUser request:
      {
        "method": "updateUser",
        "auth": {
          "token": "f19ab177-29e7-4c58-bfa0-36e9707a6977"
        },
        "params": {
          "shouldNotSyncOnStartupAfterUpdate": true
        }
      }
      • updateUser response:
      {
        "jsonrpc": "2.0",
        "result": true,
        "id": null
      }

Copy link
Contributor

@ezewer ezewer left a comment

Choose a reason for hiding this comment

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

looks good to me!

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.

3 participants