refactor: cleanup of BECClient
Description
Cleanup of BECClient. In the past, the construction of BECClient was somewhat weird and lead to many side-effects due to the inheritance of a singleton class. This MR changes the construction from inheritance to composition, solving the singleton dilemma.
The BECClient is now initialized with the config params (previously passed to the client.initialize
method). I removed the initialize
method, such that now it is sufficient to start the client using
client = BECClient(config)
client.start()
Other classes who add functionality on top of the BECClient should not inherit from it but instead use composition.
I also took the opportunity to investigate a flaky test in the e2e test suite and made some minor changes to the scan queue.
Type of Change
- BECClient refactoring
- Made sure new scan requests are not inserted while the worker is on status
STOPPED
to avoid prematurely eviction. - Added shutdown event to scan stubs to ensure the worker can shut down properly.
Additional Comments
@wyzula_j please check again if this solves the singleton problem for bec widgets.
Definition of Done
-
Documentation is up-to-date.