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

Introduce startClientFactories method to Servient #187

Merged
merged 2 commits into from
Oct 23, 2024
Merged

Conversation

JKRhb
Copy link
Member

@JKRhb JKRhb commented Oct 23, 2024

As it is the case with the Servient class in node-wot, the start method in dart_wot is currently marked as async. This makes sense in general, as the start methods of the servers registered with the Servient are also asynchronous.

However, as the corresponding init method of the ProtocolClientFactoriesis not asynchronous (at least in dart_wot), it would be possible to start the Servient synchronously and not require the surrounding environment to be async as well. Having such a synchronous, partial start method can therefore be beneficial for applications that only act as consumers.

To address this use case, this PR introduces a synchronous startClientFactories method that basically does what it advertises. It also applies some minor refactoring of the server starting code.

As, as far as I can tell, the ProtocolClientFactorys in node-wot do not actually perform any actions at the moment in their init methods, maybe this is also something that considered for node-wot as well.

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.40%. Comparing base (d6acac1) to head (a8f519f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   63.34%   63.40%   +0.06%     
==========================================
  Files          78       78              
  Lines        2275     2279       +4     
==========================================
+ Hits         1441     1445       +4     
  Misses        834      834              

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

@JKRhb JKRhb force-pushed the synchronous-start branch from 9442e59 to a8f519f Compare October 23, 2024 14:18
@JKRhb JKRhb added the Discuss in Committer Meeting Labels issues and PRs that should be discussed in our regular Thingweb Committer Meeting. label Oct 23, 2024
@JKRhb
Copy link
Member Author

JKRhb commented Oct 23, 2024

I will go ahead and merge this PR, but I applied the "Discuss in Committer Meeting" label, so maybe we can have a brief technical discussion about this in one of our next calls.

@JKRhb JKRhb enabled auto-merge October 23, 2024 14:20
@JKRhb JKRhb merged commit 738d925 into main Oct 23, 2024
4 of 5 checks passed
@JKRhb JKRhb deleted the synchronous-start branch October 23, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discuss in Committer Meeting Labels issues and PRs that should be discussed in our regular Thingweb Committer Meeting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants