GitHub user haze518 added a comment to the discussion: Support sending messages 
in the background

I like the in-flight mode, but it seems that it complements 
IggyBackgroundSendFailureMode rather than replacing it, since in-flight is more 
about the actual sending of messages. Please correct me if I’m wrong.
It looks like we still need to control the behavior when the max_in_flight 
limit is exceeded.
For example, if we implement this using a semaphore, the logic might look like 
this:
```rust
// read from channel
match failure_mode {
    Block           => permit = sem.acquire().await,
    Timeout(t)      => permit = timeout(t, sem.acquire()).await?,
    FailImmediately => permit = sem.try_acquire()?,
}
spawn(send_batch(permit, batch, delivery_timeout))
```

GitHub link: 
https://github.com/apache/iggy/discussions/1593#discussioncomment-13125638

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to