-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
size/SSmall task. (A couple of hours of work.)Small task. (A couple of hours of work.)
Milestone
Description
Our shutdown is async yet we only expose a blocking version of wait() on the Shutdown object.
public struct Shutdown {
private let receptacle: BlockingReceptacle<Void>
init(receptacle: BlockingReceptacle<Void>) {
self.receptacle = receptacle
}
public func wait(atMost timeout: TimeAmount) throws {
guard self.receptacle.wait(atMost: timeout) != nil else {
throw TimeoutError(message: "Shutdown did not complete", timeout: timeout)
}
}
public func wait() {
self.receptacle.wait()
}
}Users may want to just provide a callback to run on completion of the shutdown.
NIO's API shape is
func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void)
So something similar could be good.
We assume the global queue currently, so we perhaps should rather ask to be provided the queue to use as well.
Metadata
Metadata
Assignees
Labels
size/SSmall task. (A couple of hours of work.)Small task. (A couple of hours of work.)