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

Make migration an asynchronous task #4666

Merged
merged 5 commits into from
Mar 14, 2024

Conversation

WithoutPants
Copy link
Collaborator

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.

image

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 an error field, and a new status FAILED 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.

image
image

@WithoutPants WithoutPants added the improvement Something needed tweaking. label Mar 7, 2024
@WithoutPants WithoutPants added this to the Version 0.26.0 milestone Mar 7, 2024
@WithoutPants WithoutPants merged commit e592938 into stashapp:develop Mar 14, 2024
2 checks passed
halkeye pushed a commit to halkeye/stash that referenced this pull request Sep 1, 2024
* Add failed state and error to Job
* Move migration code
* Add websocket monitor
* Make migrate a job managed task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something needed tweaking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant