ray.serve.request_router.RequestRouter.on_request_completed#

RequestRouter.on_request_completed(replica_id: ReplicaID, internal_request_id: str) None[source]#

Called when a request to a replica has completed.

This lifecycle hook is called after a request finishes (successfully or with an error). It can be used by request routers that need to perform cleanup after a request completes, such as releasing capacity tokens.

Parameters:
  • replica_id – The ID of the replica that handled the request.

  • internal_request_id – The internal unique identifier for the request (from RequestMetadata.internal_request_id).