Summary

Implements the shutdownCause method for ZIO Queue as requested in issue #9844.

Changes

  • Add shutdownCause(cause: Cause[Nothing]): UIO[Chunk[A]] method to Queue, Enqueue, and Dequeue traits
  • Keep existing shutdown behavior unchanged (now delegates to shutdownCause)
  • Implement atomic “first caller wins” semantics for concurrent shutdownCause calls
  • On shutdownCause: fail pending takers and backpressured putters with the same cause
  • Future queue operations (offer, take, poll, size, takeAll, takeUpTo) fail with stored cause
  • awaitShutdown completes immediately when shutdownCause is called
  • Return buffered items to winning caller; later callers get Chunk.empty

Testing

All existing queue tests should continue to pass. The implementation is backward compatible with the existing shutdown behavior.

/claim #9844

Claim

Total prize pool $1,100
Total paid $0
Status Pending
Submitted March 29, 2026
Last updated March 29, 2026

Contributors

17

172313193-qq-com

@172313193-qq-com

100%

Sponsors

SU

Supreme Labs

@supreme2580

$1,000
ZI

ZIO

@ZIO

$100