grpc / grpc/grpc-node

`grpc.Client.close()` should have a callback when all calls complete

Open
#1,340 8 comments 0 reactions 0 assignees View on GitHub
feature request package: @grpc/grpc-js
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Is your feature request related to a problem? Please describe.

I'd like to call `close` on all grpc clients when the app is shutting down, and wait for the in-flight requests to complete.

### Describe the solution you'd like
As per #1211:

>The `close` method prevents new calls from being started and frees up resources once all active calls have finished

I'd like to get a callback "once all active calls have finished" so I know it's safe to shutdown the server

(ideally it'd return a `Promise`, but since the API is using callbacks, this should as well for consistency)

### Describe alternatives you've considered
Right now we call `close` then immediately `process.exit(0)`. It generally works fine, but there might be inflight requests we then ignore.

### Additional context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.