feat: Improve Mycelium slave and streamer communication
- Renamed the topic for database synchronization messages from 'db_sync' to 'sync_db' for clarity. - Updated the Mycelium slave to decode base64 payload before processing and to log received messages and their source. - Added logging to the Mycelium streamer to track sent messages. - Added a new feature to retrieve and log the last index from the worker after syncing updates. This improves monitoring and debugging capabilities.
This commit is contained in:
@@ -67,11 +67,13 @@ pub fn (mut s MyceliumStreamer) write(record MyceliumRecordArgs) !u32 {
|
||||
|
||||
// Broadcast to all workers
|
||||
for worker_key, mut _ in s.workers {
|
||||
s.mycelium_client.send_msg(
|
||||
println('Sending message to worker: ${worker_key}')
|
||||
msg := s.mycelium_client.send_msg(
|
||||
public_key: worker_key // destination public key
|
||||
payload: data.str() // message payload
|
||||
topic: 'sync_db' // optional topic
|
||||
)!
|
||||
println('Sent message ID: ${msg.id}')
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user