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:
Mahmoud Emad
2025-03-02 22:01:44 +02:00
parent dbd187a017
commit 71906fd891
2 changed files with 15 additions and 4 deletions

View File

@@ -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
}