Skip to content

refactor service lifecycle managment and service/engine architecture #49

@thorinaboenke

Description

@thorinaboenke

Engine.start() and stop() handle threading and socket lifecycle manually
Problems:
-> race conditions: _thread may be joined multiple times or while recv() is blocking. Closing sockets during a running loop can cause crashes or fatal errors in tests.

-> lifecycle management:
start()/stop() logic is duplicated and error-prone.
_running and _stop_event flags are manually handled.

--> inconsistent error handling:
Socket errors (pynng.NNGException) and processor exceptions propagate directly.

Possible Improvements
state machine pattern for engine life cycle?
context managers? (with Engine(...) as engine:)
idenmpotent start/stop
custom exception hierarchiy?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions