# Fix config file watch task leak \(\#47246\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d63067762a8c4274307979b6a9db7ba89b3c7458

Requested commit: d63067762a8c4274307979b6a9db7ba89b3c7458

Commit: d63067762a8c4274307979b6a9db7ba89b3c7458

Tree: 3391beb1437a0d2551da098c8f14a1c51d3e8ec3

Author: Ben Kunkle

Committer: GitHub

## Message

```
Fix config file watch task leak (#47246)

Follow-Up-For:  #47243

Previously, we would detach tasks spawned to watch config files.
However, the task blocked on receiving a file event before checking if
the receiver for the updates channel was dropped, causing the task to
never exit. The fix here was to return the task explicitly, so that it
can be dropped instead of calling `.detach()` on it. There is definitely
a way to `select!` between the receiver being dropped and the next file
system event, but I couldn't figure it out in a reasonable amount of
time and decided it wasn't worth it.

Release Notes:

- Fixed an issue where a few file descriptors would be leaked each time
a project was closed
```

## Parents

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

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