#28 - stop using Thread as CleverSwarm methods are not thread-safe
This commit is contained in:
@@ -75,12 +75,21 @@ class DataMessageHandler:
|
||||
self.file_handler: FileHandler = file_handler
|
||||
self.backpressure_handler: BackpressureHandler = backpressure_handler
|
||||
|
||||
async def inbound_data_message_callback(self, message: AbstractIncomingMessage):
|
||||
async def inbound_data_message_callback_as_thread(
|
||||
self, message: AbstractIncomingMessage
|
||||
):
|
||||
"""
|
||||
The callback method that is called when a DataMessage is received from RabbitMQ, starts new Thread.
|
||||
"""
|
||||
threading.Thread(
|
||||
target=lambda: asyncio.run(self.run_callback_thread(message))
|
||||
target=lambda: asyncio.run(
|
||||
self.inbound_data_message_callback_no_thread(message)
|
||||
)
|
||||
).start()
|
||||
|
||||
async def run_callback_thread(self, message: AbstractIncomingMessage):
|
||||
async def inbound_data_message_callback_no_thread(
|
||||
self, message: AbstractIncomingMessage
|
||||
):
|
||||
"""
|
||||
Receives the DataMessage as bytes from RabbitMQ queue and deserializes it to the DataMessage object
|
||||
Ensures Jaeger trace-id propagation.
|
||||
|
||||
Reference in New Issue
Block a user