-
Notifications
You must be signed in to change notification settings - Fork 90
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
Allow users to set custom timeout to the requests #1032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! @AsianCat54x
Thanks for your contribution :)
Can I ask you the following before reviewing your code:
- Change the title of the PR to something more explicit. We do not have any rules except that the name of the PR should follow the sentence
This PR will....
.
For example if my pr fixes a typo in the readme the title would be Fixes typo in README
/
- Fix the linting errors.
Both the code and the code formatting are tested. At this section of the CONTRIBUTING you can see that you haveyarn style
andyarn style:fix
. The latter will fix the code automatically for you!
So shall I keep somethings like this: This PR will fix issue #716 Alright so I actually didnt see CONTRIBUTING.md. (My bad) So all I need to do is lint the code with yarn. So what about the AbortController error? (Here is a stackoverflow nswer - https://stackoverflow.com/a/58232108/16789038) |
About the name while it does fix issue 716, the title should explain what the code in the PR fixes, not which issue is fixed. For that we use the So, the question you have to ask yourself is About the AbortController issue it is because you don't import it. But 'ill get to your code review once the formatting and the name have been fixed. |
Oh I see! Alright I will think of a good title I dont know why I am getting error while running |
did you try |
Firstly when I ran And btw, Is the title good? Will using vscode's eslint do the trick? |
The title of the issue is great! Did you install the dependencies? |
I ran Now that the command is running, I am linting all the files and committing |
Good work for the styling! Now when you work on a PR it is better to get the tests running so you know when you are breaking the code.
Or with another method explained in the documentation. You can also follow the getting started of MeiliSearch to understand better. Tell me when you have a running MeiliSearch |
Oke! Now you should run the tests by doing |
@bidoubiwa Good news here! All the test passed yay! Here is a picture: Note: I have edited some files |
Are you using |
Yes, |
I don't think it is working in previous versions of node. So the question is, do we want to add a package I don't think we want :s |
Yeah, I installed abort controller and then ran the tests, it ran perfectly. Should I commit the changes I have made? If you dont want to add the abort-controller package, I could just use any other solutions to do the trick. |
Are their other solutions than abort-controllers ? Yes I think tests fail with node 14 as abort controller is introduced in node 16. |
Hey @AsianCat54x i will be reviewing your pr next week! |
Hey @bidoubiwa, can you review? |
@bidoubiwa, am I missing something? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry very busy weeks
It seems to work fine :) Could you add some tests to ensure this is not provokings any bugs?
Also you used 'Error: Request Timed Out'
, but there is a MeiliSearchTimeoutError in /errors
could you use this one when a timeout is thrown?
src/lib/http-requests.ts
Outdated
const controller = new AbortController() | ||
|
||
if (this.timeout === undefined) { | ||
this.timeout = 3000 | ||
} | ||
|
||
setTimeout(() => { | ||
controller.abort() | ||
}, this.timeout) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move your code inside the try
scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that error doesn't do anything. I kind of forget to remove that. Anyway, It will be required to add tests.
Hey, @bidoubiwa, I guess the only task left is to add tests, right? Its just that I am not able to create one. Can you help me by telling in which file I should make and where? |
I would be glad to help you through this task. I'm adding the If you are participating in Hacktoberfest, and you would like to receive a small gift from MeiliSearch too, please complete this form. |
Yeah, I am participating in Hacktoberfest! Thanks, @bidoubiwa! |
Hello @0xsapphir3 |
Sure :) |
This pull request should fix #716