Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add withAbortSignal() #93

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

theogravity
Copy link

Addresses #92

@@ -183,6 +183,8 @@ export default class DefaultRESTClient<RT, ERT> implements IRESTClient<RT, ERT>
body: this.body as BodyInit,
// @ts-ignore (Credentials are not supported on NodeJS)
credentials: this.credentials,
// 60-second timeout expressed in ms
timeout: 60000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use signal: AbortSignal.timeout( 60000 ) instead, since the options doc says Signal is recommended instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use a timeout, the timeout value should be set on the class and referenced just like we do for credentials.

So I would suggest we :

  • add a new field for timeout, we can default to 60 seconds if we want.
  • add new with* method so this can be set using the builder pattern.

Agree with @mooreds - sounds like the API doc suggest using Signal instead.

Then, to complete this work, we'll need to expose this in the FusionAuth REST client. Perhaps we can add this to the builder once this PR is complete.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR to add a withAbortSignal() instead.

I'm not sure how this gets incorporated into the two files mentioned above, though.

@theogravity theogravity changed the title Set request timeout to 60s Add withAbortSignal() Jul 9, 2024
@@ -5,7 +5,8 @@
"declaration": true,
"sourceMap": true,
"lib": [
"es2015"
"es2015",
"dom"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required to add the AbortSignal type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants