You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throttling introduced in #12 helps with request flood, but there is a separate problem of the lack of request timeouts in web browser. Some requests can take a very long time and will suffocate request queue because they have no built-in timeout (namely /api/v0/refs):
This also means we can't use js-ipfs-http-client because it does not support cancellations: https://github.com/ipfs/js-ipfs-http-client/issues/694. For this very reason js-ipfs does not use ipfs-http-client for preload calls to /api/v0/refs: instead it is using manual fetch with AbortController in web browser (preload-browser.js) and req.abort in Node (preload-nodejs.js)
If we call provide every CID we add (which I think we do) then we don't need the recursive flag. This will reduce the RTT for each call to provide significantly.
Throttling introduced in #12 helps with request flood, but there is a separate problem of the lack of request timeouts in web browser. Some requests can take a very long time and will suffocate request queue because they have no built-in timeout (namely
/api/v0/refs
):This also means we can't use
js-ipfs-http-client
because it does not support cancellations: https://github.com/ipfs/js-ipfs-http-client/issues/694. For this very reason js-ipfs does not use ipfs-http-client for preload calls to/api/v0/refs
: instead it is using manualfetch
withAbortController
in web browser (preload-browser.js
) andreq.abort
in Node (preload-nodejs.js
)We need to do the same, or use js-ipfs-http-client-lite (add missing commands if needed).
@jacobheun @alanshaw thoughts on which way is better? Is this library aimed only at browsers, or will it be used in Node as well?
The text was updated successfully, but these errors were encountered: