feat: Update slave communication in mycelium example
- Rename `get_last_id` to `get_last_index` for clarity. - Correctly send sync message to the slave instead of master.
This commit is contained in:
@@ -48,12 +48,12 @@ defer {
|
|||||||
|
|
||||||
// Send the last inserted record id to the master
|
// Send the last inserted record id to the master
|
||||||
// data := 'Test data for sync - ' + time.now().str()
|
// data := 'Test data for sync - ' + time.now().str()
|
||||||
id := db.get_last_id()!
|
id := db.get_last_index()!
|
||||||
println('Last inserted record id: ${id}')
|
println('Last inserted record id: ${id}')
|
||||||
|
|
||||||
// Send sync message to slave
|
// Send sync message to slave
|
||||||
println('\nSending sync message to slave...')
|
println('\nSending sync message to slave...')
|
||||||
msg := master.send_msg(
|
msg := slave.send_msg(
|
||||||
public_key: master_public_key
|
public_key: master_public_key
|
||||||
payload: 'last_inserted_record_id,${id}'
|
payload: 'last_inserted_record_id,${id}'
|
||||||
topic: 'db_sync'
|
topic: 'db_sync'
|
||||||
|
|||||||
Reference in New Issue
Block a user