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

runtime: Create controller in RpcClient constructor #5450

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

kostko
Copy link
Member

@kostko kostko commented Nov 16, 2023

Previously if no RPC calls were initiated by the runtime, the client controller task was never spawned which caused quote policy update requests to pile up in the command queue, eventually blocking the entire runtime from processing requests.

Since the async runtime is now available early on during initialization, we can spawn the controller in the RpcClient constructor, avoiding these problems.

@kostko kostko added the c:bug Category: bug label Nov 16, 2023
@kostko kostko force-pushed the kostko/fix/erpc-client-controller branch from fc45bed to e4bc41c Compare November 16, 2023 09:54
Previously if no RPC calls were initiated by the runtime, the client
controller task was never spawned which caused quote policy update
requests to pile up in the command queue, eventually blocking the entire
runtime from processing requests.

Since the async runtime is now available early on during initialization,
we can spawn the controller in the RpcClient constructor, avoiding these
problems.
@kostko kostko force-pushed the kostko/fix/erpc-client-controller branch from e4bc41c to 4a1efe9 Compare November 16, 2023 10:13
@kostko kostko marked this pull request as ready for review November 16, 2023 10:31
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7392529) 66.51% compared to head (4a1efe9) 66.79%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5450      +/-   ##
==========================================
+ Coverage   66.51%   66.79%   +0.27%     
==========================================
  Files         533      533              
  Lines       56387    56387              
==========================================
+ Hits        37507    37662     +155     
+ Misses      14478    14320     -158     
- Partials     4402     4405       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kostko kostko merged commit 39d372e into master Nov 16, 2023
@kostko kostko deleted the kostko/fix/erpc-client-controller branch November 16, 2023 10:54
cmdq: rx,
cmdq_tx: tx.clone(),
};
tokio::spawn(controller.run());
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, although I'm not a big fan of creating tasks or goroutines in the constructor, as they are hidden from the caller, not under caller's control and they usually cause troubles in tests (in this case, one must ensure Tokio runtime is available).

Copy link
Member Author

Choose a reason for hiding this comment

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

True, but this way it avoids a needless atomic + mutex.

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

Successfully merging this pull request may close these issues.

3 participants