-
Notifications
You must be signed in to change notification settings - Fork 451
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
Refactoring of the TriblerNetworkRequest
#7205
Conversation
cc7dfe7
to
304cebf
Compare
For the love of Guido, why not just |
4ab0be8
to
f8ebc1b
Compare
TriblerNetworkRequest
TriblerNetworkRequest
There are always several ways of writing code. I used this example above because it better describes the actual change. And anticipating your next question. This is: request = Request(
endpoint="ipv8/asyncio/drift",
on_finish=self.on_ipv8_health_enabled,
data={
"enable": True
},
method=Request.PUT
)
request_manager.add(request) better than: request_manager.add(
Request(
endpoint="ipv8/asyncio/drift",
on_finish=self.on_ipv8_health_enabled,
data={
"enable": True
},
method=Request.PUT
)
) |
Even in cases like this? request = Request("statistics/tribler", self.on_tribler_statistics)
request_manager.add(request) vs request_manager.add(Request("statistics/tribler", self.on_tribler_statistics)) To me, the second one reads almost like natural text. |
Yes. |
0644084
to
92c36a4
Compare
…_data for serialized data and request.data for original data
897b1e8
to
518a1d1
Compare
@kozlovsky thank you for the detailed feedback and for refining the code 🤝 |
30801e7
to
7bcf112
Compare
Related to #7187
The main changes in this PR are the following:
TriblerNetworkRequest.on_finish()
andTriblerNetworkRequest.cancel()
TriblerNetworkRequest
. This change opens an opportunity to write correct tests forTriblerNetworkRequest
.Minor changes:
TriblerNetworkRequest
andTriblerRequestManager
.The PR looks huge but it is mostly because the way how a
TriblerNetworkRequest
should be added toTriblerRequestManager
has been changed.From
Request()
To