actix / actix/actix-web

Future cancellation doesn't seem to works when a client disconnect

Offen
#3,462 0 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

## Expected Behavior

I want actix-web to stop processing requests when the client closed the connection.

## Current Behavior

It doesn't stop processing the request.

https://github.com/user-attachments/assets/d498d469-93a5-4aed-8307-1257c2cf4ab1

## Possible Solution

Providing a way to see if the connection is still alive, if that’s even possible with tcp?

## Steps to Reproduce (for bugs)

See https://github.com/irevoire/actix-web-future-cancellation-on-timeout

## Context

In Meilisearch we cannot process more search requests than we have core.
But we don't want to refuse search requests when all cores are used, which means we have to store a queue of search requests to process.
Sometimes users have searches that can take a few seconds to process.
When this happens, emptying the queue takes time. But it shouldn’t since most clients will disconnect after waiting for a few seconds.

When the queue gives us a permit to process a new search requests, I would like to check if a client is still connected before doing any extra work.

## Your Environment

- Rust Version (I.e, output of `rustc -V`): rustc 1.78.0 (9b00956e5 2024-04-29)
- Actix Web Version: 4.9.0 and 4.8.0

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.