# Flush all persistence threads for the rest for various shutdown cases \(\#63213\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/279da638826ac28b7b1d22d390cc5ae3caef89f9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 279da638826ac28b7b1d22d390cc5ae3caef89f9

Requested commit: 279da638826ac28b7b1d22d390cc5ae3caef89f9

Commit: 279da638826ac28b7b1d22d390cc5ae3caef89f9

Tree: d9c6577aacc04b4d02c9e470fa2c25c8b3457cbf

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Flush all persistence threads for the rest for various shutdown cases (#63213)

Follow-up to https://github.com/zed-industries/zed/pull/60477
Closes #25022

We have more places that need a similar synchronization before quitting
the app: restarts on update, reloading the workspace.

On top of it, two more findings:

* `on_app_will_quit` was redundant: the global `on_app_quit` hook
flushes a strict superset of the same tasks and runs before windows are
cleared, while the entity hook held only a weak handle and could never
flush the `Window`-dependent workspace state anyway.

* previously, shutdown was run as `cx.spawn`, yet main threads got
parked on app shutdown: now using `cx.background_spawn` instead

Release Notes:

- Improved data persistence during various app shutdown cases

---------

Co-authored-by: Kostia R <k-bx@k-bx.com>
```

## Parents

- [839ab7a9f71351bc3d64d37378364948db049f06](https://git.cafe/gitcafe/zed/commit/839ab7a9f71351bc3d64d37378364948db049f06?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/279da638826ac28b7b1d22d390cc5ae3caef89f9?format=markdown)
