googleapis / googleapis/google-cloud-node

[pubsub] AbortSignal support for the subscriber client

Open
#7,627 1 comment 0 reactions 0 assignees View on GitHub
api: pubsub priority: p2 type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

### A screenshot that you have tested with "Try this API".

This problem applies specifically to the Node.js client. It's not an issue with the API itself.

### What would you like to see in the library?

A way to abort cleanly when the service needs to exit (without setting a very low timeout). It would be nice if the pull method supported AbortSignal like so since AbortSignal is becoming the standard way to abort promises:

```ts
const abortController = new AbortController();
const client = new v1.SubscriberClient({ projectId });

const [response] = await client.pull({
subscription: subscriptionId,
maxMessages: 100,
}, {
signal: abortController.signal <-- This
});
```

### Describe alternatives you've considered

_No response_

### Additional context/notes

_No response_

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.