-
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
Refactor the JSON-RPC connection #52
base: main
Are you sure you want to change the base?
Conversation
6855b25
to
755c7f5
Compare
Can you explain to me the different purposes of the modules |
@maehjam It is less mixed up than it was, but I get that it may still be under documented. grisp_connect_jsonrpc is only doing JSON-RPC encoding/decoding, grisp_connect_connection encapsulate a JSON-RPC connection, and grisp_connect_client encapsulate the girps_connect client protocol. |
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.
- The logger changes and architecture changes of the websocket connection shouldn't be in the same PR. Both are changes in parts that are hard to test. They each need very careful testing and probably manual testing in addition to the automatic testing.
- Is this working with the current
grisp_manager
implementation or do we need to adjustgrisp_manager
as well?
reset_log() -> | ||
reset_log(undefined). | ||
|
||
reset_log(LasSeq) -> |
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.
You could have just fixed last_seq/0
to do that. Now we do more or less the same twice.
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.
True, it ended up like this because I tried a lot of different ways to fix the issue, and the last working one could have been done in last_seq/0. I could change that.
@@ -20,7 +20,6 @@ wait_connection() -> | |||
wait_connection(30_000). | |||
|
|||
wait_connection(0) -> | |||
ct:pal("grisp_connect_ws state:~n~p~n", [sys:get_state(grisp_connect_ws)]), |
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.
Why remove the logs?
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.
Because now there is not always a permanent connection process, it may not be there and instead of trying to do some error handling and showing the state only when the connections there, given it is only debug information I just removed the line.
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.
You have connect and disconnect in every test case. I would do that in init_per_testcase
and end_per_testcase
.
src/grisp_connect_connection.erl
Outdated
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.
I feel with the timeouts and the distinction between connected and disconnected in handle_call
this would be much better readable as a gen_statem
. The module name is a bit strange, I liked grisp_connect_ws
better.
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.
It does way more than the old grisp_connect_ws. This remove complexity not related to the API from the client and API and could be reused easily. What would be the states if it was a statem ?
I only change the logging int he new code, I didn't touch the logging in the old code. What do you mean by these change shouldn't go together ? |
- Small changes in tests from review feedback
Changed
individual JSON-RPC requests changed from ws_requests_timeout ot
ws_request_timeout.
filtering out all progress messages, as it wasn't working reliably.
process handling a connection and dying when the connection is closed.
road for namespaces. foo.bar.Buz is parsed into [foo, bar, <<"Buz">>] (if foo
and bar are already existing atoms, but 'Buz' is not).
Fixed
disconnected fomr the server.