-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update handler and caller timeouts to be able to overwrite server and client default timeouts regardless of value. #47
Conversation
This needs a test for the overriding behaviour, both lesser and greater. Also remember to squash. |
Is the best way to reset the timer vs just setting the overriding the actual timeout value? |
Idk what you mean by this |
ac99f3a
to
1bc5ac5
Compare
Can we override the timeout number? |
I think you need to show in a test very clearly.
I don't see 1. in the test. |
992d374
to
61d6721
Compare
Don't check the final checklist until the very end. |
Let's expand the scope of this PR a bit, it really should ensure that localised timeouts override global timeouts for both client and server. |
@amydevs can you take over this PR since the js-rpc actually requires consideration of the timeout architecture properly - I would want this the entire thing to be documented on the Plus the name of the timeout parameters... is very weird, can you make them consistent between |
@amydevs see the comment here: MatrixAI/Polykey#589 (comment) |
80a3615
to
c96c066
Compare
60f3954
to
b1c1608
Compare
c917ea7
to
93d535a
Compare
|
This is a good start, but this information needs to be condensed into a requirement and put into the spec. We want it clear and easy to find that this is how we want the RPC to behave as a requirement. |
@addievo write up the spec in a better way onto the README.md. Use a list or table. |
6f1a568
to
4e29479
Compare
d6d29a4
to
ea8c0df
Compare
…ault server and client timeouts regardless of their default valu fix: renamed `RPCClient.timeout` and `RPCServer.timeout` to `timeoutTIme` fix: timeout tests for RPCClient and RPCServer fix: fixed removed redundant tests [ci-skip]
chore: add tests to test negative timeout values. fix: 0 `timeoutTime` value no longer throws in `RPCClient` fix: `RPCServer.start` now throws when passed a handler with a negative `timeout` [ci-skip]
ea8c0df
to
f397972
Compare
fix: `README.md` example was incorrect [ci-skip]
f397972
to
b835226
Compare
Requires rebase? |
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.
Looks fine to me but it needs linting.
[ci skip]
I'm going to merge now and do a release. |
Description
Previously
Handler.timeout
could only overwrite the default timeout if it was lesser than the default timeout, this is problematic in instances where we need a greater timeout than default timeout as inMatrixAI/Polykey#589 (comment)
The previous implementation of timeout was as so:
This PR aims to override this by allowing
Handler.timeout
to have priority over normal timeout irrespective of value, this is implemented as so.With this we hope to be able to have custom timeout for handlers even if we need to extend the timeout to be more than the default value.
Further, this PR aims to write tests to test this functionality, these tests are simply structured to have a handler timeout, which can be either greater or lesser than the default server timeout, the
handlerTimeoutTime,
and then to check if the updated timeout is set as thectx
timer.These tests can be structured as so:
In the aforementioned test, the server timeout was set to 50, and the Handler timeout to 250, consequently the final ctx timer should be 250, and this is expected.
Similar test for a lesser timeout is conducted.
Although the functionality of setting Client timeout through caller was already present, the tests to check the same were lacking, this PR also aims to include such tests. These tests would be structured similarly to the server tests wherein a client is created with a
streamKeepAliveTimeoutTime
and then the caller sets a different timeout, either greater or lesser, and we expect the ctx timer to be set according to the caller set timer, which can be expected as such:In the aforementioned test, the client timeout is initially set to 150ms, and then changed to 100ms, we expect the timer delay to be 100.
Issues Fixed
Tasks
Final checklist