googleapis / googleapis/google-cloud-node

Accept AbortSignals in async methods

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

Description

Methods like `.get()` should accept an AbortSignal to cancel the request.

AbortSignals are becoming more prevalent in platform and library APIs, and it's pretty easy to feed a signal from client-side code, into server requests handlers, and into libraries like firestore, which can send them to the underlying `fetch()` call, to cancel a database call.

Example using tRPC, which provides abort signals:

```ts
const appRouter = router({
getDocs: procedure.query(async ({signal}) => {
return db.collection('documents').get({signal});
}),
});
```

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.