File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -541,6 +541,9 @@ export class Counter extends DurableObject {
541541 `http://do/chain?ms=${ ms } &targets=${ rest . join ( ',' ) } `
542542 ) ;
543543 if ( ! response . ok ) return response ;
544+ // Until its body is read, the called DO counts as busy, and a drain
545+ // waits for it until it cancels the requests in flight.
546+ await response . arrayBuffer ( ) ;
544547 }
545548 const count = ( ( await this . state . storage . get ( 'count' ) ) ?? 0 ) + 1 ;
546549 await this . state . storage . put ( 'count' , count ) ;
Original file line number Diff line number Diff line change @@ -298,6 +298,11 @@ struct ClusterConfig {
298298 # itself that way ends only with the requests in flight. Stopping an object's Docker container
299299 # takes one of the few handoffs that run at once.
300300 #
301+ # A request to a Durable Object stays in flight until the body of its response is read, so a
302+ # caller that checks `res.ok` and drops the response keeps the object busy, and its handoff waits
303+ # for half of this timeout before it cancels the request. Read or cancel a body you don't use
304+ # (`await res.body?.cancel()`).
305+ #
301306 # The default fits within the 10 seconds that `docker stop` and Docker Compose give a container,
302307 # and the 30 seconds that Kubernetes gives a pod (`terminationGracePeriodSeconds`). Raising this,
303308 # raise the supervisor's grace period too (`docker stop -t`, `stop_grace_period`,
You can’t perform that action at this time.
0 commit comments