Moving away from the global context #1841
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-05#1841
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello!
Your comment in #1839 triggered a huge reflection in my brain regarding the architecture of threads in the main package. I suddenly realized that they have the same birth injury as a
bitmessageqt
app: global context. I started a branch incapsulation where I'm going to address the issue in thesingeWorker
as an example. You cannot just take the current code and write a test case which start thesingeWorker
thread isolated from the rest ones, because it uses SQL, Inventory, queues and the shared objects...In this ticket I'm going to describe the solutions I already found and formulated as they arrive, so we could continue the discussion, started in #1828.
The points so far:
invQueue
, Inventory can feed it itselfMsgBox
, the base class for Inbox, Outbox, etc. The worker needs it's method ~get_by_status()
for the queries like this. The implementation is not have to be tied to theSQLThread
.The minor issues can be addressed there:
getattr(self, 'handle_{}'.format(command))
instead of the if: else: ladderprotocol
or it's imported submodule (e.g. fe691a5) and cover by teststhe latter will help removing all the pylint comments. You will also see why I hate those tiny formatting changes: I see most of those blocks removed or moved into another modules (e.g. cf8c3ac) but writing code takes time ):