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

feat(migration): adjust BackendProcess, main.dev.js & App.ts so we can coordinate migrations! #571

Merged
merged 5 commits into from
Jul 16, 2020

Commits on Jul 15, 2020

  1. refactor(backend.js): emit messages to renderer process during backen…

    …d launch
    
    We refactor the `BackendProcess` class to have specific methods that the main process can use to orchestrate launching the backend app
    Because we can only emit events to the renderer process in the main process (so no way to emit them in `BackendProcess`, unless we pass the `mainWindow` down to the `BackendProcess` class) this exposes a bunch of launching functionality to the main process (it was previously all hidden in the `backendProcess.maybeStartup()` function)
    
    In future refactors, am definitely open to pushing `mainWindow` down to `BackendProcess` and dealing with all aspects down there. However, as a first iteration I think this is fine.
    
    The logic for this the start up goes like this:
    - if a backend process is already running, error. Catch the error & send a message to the renderer that a qri backend is already running
    - check if we have a compatible backend version. If it's too low, send a message to the renderer that the version is incompatible
    - check if we need a migration - if we do, send a message to the renderer that we are migrating
    - launch the backend
    ramfox committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    fe75e18 View commit details
    Browse the repository at this point in the history
  2. refactor(ui reducer): add bootupComponent as field on state.ui

    - add `BootupComponentType`
    - `state.ui.bootupComponet` defaults to 'loading'
    - add `UI_SET_BOOTUP_COMPONENT` action type
    - add `setBootstrapComponent` action
    - add `selectBootstrapComponent` selector
    ramfox committed Jul 15, 2020
    Configuration menu
    Copy the full SHA
    4638b95 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

  1. refactor(main): need to wait for app to be loaded before coordinating

    Both the renderer process and main process need to be on before we can successfully coordinate behavior.
    
    `App` component now emits an `app-fully-loaded` event.
    
    Moved the backend launching process into the ipcMain `app-fully-loaded` event handler. This also means that whenever the app re-loads, we check for a backend connection, and if we don't find one we launch again. Which I think is a nice pick up!
    
    Downside is we get slightly longer loading time in dev mode (since it takes a bit to compile the app), but no discernible changes in prod mode!
    ramfox committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    9f1490d View commit details
    Browse the repository at this point in the history
  2. refactor(backend): saner checkNeedsMigration function

    now that the backend flags/expectations have changed, we can run any comand to see if it exits with code `2` (which indicates that a migration is needed)
    ramfox committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    7294bb6 View commit details
    Browse the repository at this point in the history
  3. refactor(backend.js): use correct flags in qri connect & use `qri c…

    …onfig` as migration check
    ramfox committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    a37beb5 View commit details
    Browse the repository at this point in the history