Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/src/polling_monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,25 @@ mod tests {

#[graph::test]
async fn polling_monitor_cancelation() {
const REQ: &str = "req-0";

// Cancelation on receiver drop, no pending request.
let (mut handle, _monitor, rx) = setup();
drop(rx);
assert!(handle.next_request().await.is_none());

// Cancelation on receiver drop, with pending request.
let (mut handle, monitor, rx) = setup();
monitor.monitor("req-0");
monitor.monitor(REQ);
drop(rx);
assert!(handle.next_request().await.is_none());
let mut next = handle.next_request().await;
if let Some((a, _)) = next {
// The request may or may not have been pulled from the queue
// before cancelation.
assert_eq!(REQ, a);
next = handle.next_request().await;
}
assert!(next.is_none());

// Cancelation on receiver drop, while queue is waiting.
let (mut handle, _monitor, rx) = setup();
Expand Down