# Use a \`FuturesUnordered\` to process foreground messages · gitcafe/zed

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

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

Visibility: public

Requested revision: fb2590d913663730001c53dfa2dcdfd07acbe27d

Requested commit: fb2590d913663730001c53dfa2dcdfd07acbe27d

Commit: fb2590d913663730001c53dfa2dcdfd07acbe27d

Tree: dc4b9d09d2556f635a91a94ade6b3d6065fe9b2b

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Use a `FuturesUnordered` to process foreground messages

This prevents deadlocks when e.g., client A performs a request to client B and
client B performs a request to client A. If both clients stop processing further
messages until their respective request completes, they won't have a chance to
respond to the other client's request and cause a deadlock.

This arrangement ensures we will attempt to process earlier messages first, but fall
back to processing messages arrived later in the spirit of making progress.

```

## Parents

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

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