Make migration an asynchronous task #4666
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses a long standing issue where running a schema migration that takes a long time can time out the connection if running through a reverse proxy.
This changes the migration operation to be a job-based task rather than synchronous operation. This is a breaking change to the
migrate
mutation - it now returns a job ID immediately. It is left to the client to monitor the status of the migration job.The UI is changed to monitor the job, and display a progress bar with the current migration task being performed.
Job monitoring nominally uses the websocket connection, and it's possible that this connection is not present. The lack of a websocket connection would prevent job monitoring, so if the websocket connection isn't available, then it falls back to polling every second.
To receive errors when the migration task fails, the
Job
type has been expanded to include anerror
field, and a new statusFAILED
is available.This PR also includes a connection monitor component which detects if the websocket connection fails to establish and displays a toast error. If the websocket connection is later re-established, then a toast message is shown.