Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: cancellable api calls #2993

Merged
merged 22 commits into from
May 14, 2020
Merged

feat: cancellable api calls #2993

merged 22 commits into from
May 14, 2020

Conversation

achingbrain
Copy link
Member

Passes a AbortSignal to every API call which emits a abort event when the caller is no longer interested in the result of the operation.

Lower level code that creates resources or has other long-term effects should tear down those resources early if the abort event is received.

Adds support for timeout options to every API call that will emit an abort event on the passed signal and throw a Timeout error.

Finally abort events are triggered if the current request arrived via the HTTP API and the request was aborted from the client - that is, a disconnect event is fired by Hapi.

Updates the core-api docs to add these new options.

@achingbrain achingbrain linked an issue Apr 21, 2020 that may be closed by this pull request
@achingbrain achingbrain force-pushed the feat/cancellable-requests branch 8 times, most recently from ee5d065 to f64b846 Compare May 1, 2020 16:16
Passes a [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
to every API call which emits a `abort` event when the caller is no longer
interested in the result of the operation.

Lower level code that creates resources or has other long-term effects should tear
down those resources early if the `abort` event is received.

Adds support for `timeout` options to every API call that will emit an `abort` event
on the passed signal and throw a Timeout error.

Finally `abort` events are triggered if the current request arrived via the HTTP API
and the request was aborted from the client - that is, a `disconnect` event is fired by Hapi.

- Updates the core-api docs to add these new options.
- Refactors HTTP API to replace custom args parsing with Joi
- Tests all HTTP API endpoints
- Adds pin support to `ipfs.block.put`- fixes #3015
docs/core-api/BITSWAP.md Outdated Show resolved Hide resolved
docs/core-api/BLOCK.md Outdated Show resolved Hide resolved
docs/core-api/BOOTSTRAP.md Show resolved Hide resolved
packages/interface-ipfs-core/src/files/ls.js Outdated Show resolved Hide resolved
packages/interface-ipfs-core/src/files/write.js Outdated Show resolved Hide resolved
packages/ipfs-http-client/src/add.js Outdated Show resolved Hide resolved
packages/ipfs/docs/MODULE.md Show resolved Hide resolved
packages/ipfs/src/http/api/resources/config.js Outdated Show resolved Hide resolved
packages/ipfs/src/http/api/resources/files-regular.js Outdated Show resolved Hide resolved
packages/ipfs/src/core/api-manager.js Outdated Show resolved Hide resolved
@achingbrain achingbrain merged commit 2b24f59 into master May 14, 2020
@achingbrain achingbrain deleted the feat/cancellable-requests branch May 14, 2020 10:38
SgtPooki referenced this pull request in ipfs/js-kubo-rpc-client Aug 18, 2022
Passes a [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
to every API call which emits a `abort` event when the caller is no longer
interested in the result of the operation.

Lower level code that creates resources or has other long-term effects should tear
down those resources early if the `abort` event is received.

Adds support for `timeout` options to every API call that will emit an `abort` event
on the passed signal and throw a Timeout error.

Finally `abort` events are triggered if the current request arrived via the HTTP API
and the request was aborted from the client - that is, a `disconnect` event is fired by Hapi.

- Updates the core-api docs to add these new options.
- Refactors HTTP API to replace custom args parsing with Joi
- Tests all HTTP API endpoints
- Adds pin support to `ipfs.block.put`- fixes #3015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancelable requests AKA Context
2 participants