Practice ยท 2 of 2
Graceful shutdown drain
CHALLENGE
Difficulty: advanced+25 XP
A worker must stop ACCEPTING new work immediately on shutdown, but finish what it already accepted. Implement static async Task<List<int>> ShutdownDrain(int feedCount, int shutdownAfter): a producer writes integers 0..feedCount-1; after shutdownAfter items have been WRITTEN, the producer calls TryComplete (no more accepts) โ but every item written before completion must still be consumed by a background reader collecting them via ReadAllAsync. Return the collected list. The test asserts shutdownAfter items arrive, nothing more.
Press Submit to check your solution.
Back to lesson: Practice: Channel drills