-
Notifications
You must be signed in to change notification settings - Fork 943
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 transaction handling to better separate async and sync code. #2232
Refactor transaction handling to better separate async and sync code. #2232
Conversation
213498e
to
b13e05c
Compare
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.
This a generally not the way we are moving, we do NOT want 2 implementations, so we are are currently moving more and more of the async into the sync code.
The goal is that the sync client is only a shallow shell over async code, meaning 1 implementation.
So currently the async code is using a
Um, wouldn't this then be what we want? I've made it so that |
We do not want 2 implementations ! the current difference between sync and async are basically in the transport layer, and we do not want to expand these differences. |
Generally speaking this PR adds code complexity, where our aim is to simplify the code. We are currently reworking the framer layer for version 3.7.0 and next up is the transaction layer, so adding complexity there is really not a goal. |
Clearly there's a huge difference at the transaction layer as well, keep in mind the code I moved into
I mean, I'm trying to simplify the code by making it clear which code is used by which client, I'm not changing the existing situation there or duplicating shared code. The transaction id tracking is the only part of the transaction code the async client was using, so it really shouldn't be importing a transaction class with a bunch of unused methods. Combining logic with async code can then be done afterwards where it makes sense but I think it's a good idea to do an initial refactoring to make it clear what code is used where essentially. |
You have a point in making it clear what is only sync and what is shared ! I would like to see, however, the sync part reduced, since this is the exercise I am currently doing with the frame layer and that is ultimately what we need to do on every layer. |
I don't disagree there, but I think this should be done in stages where we first ensure that we can identify which code is shared, which is async only and which is sync only, otherwise it's just too difficult IMO to reason about refactoring. |
b13e05c
to
e002ba4
Compare
e002ba4
to
db108b0
Compare
@@ -150,7 +158,7 @@ def frameProcessIncomingPacket( | |||
) -> None: | |||
"""Process new packet pattern.""" | |||
|
|||
def buildPacket(self, message) -> bytes: | |||
def buildPacket(self, message: ModbusRequest) -> bytes: |
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.
This should be ModbusRequest | ModbusResponse
Splitting off the transaction refactoring from #2230.