db.commit()
# Give Mycelite time to sync before script exits
import time
time.sleep(5)
This really needs a way to wait for the sync to complete. Sleep won't cut it. db.commit()
# Give Mycelite time to sync before script exits
import time
time.sleep(5)
This really needs a way to wait for the sync to complete. Sleep won't cut it.https://mycelial.com/docs/get-started/python#observing-synch...
If I were to write a tutorial on how to set up PG replication and "observe the replication", I think that would probably involve "write to master, sleep for a bit, then see the data is in the secondary."
I asked this to ChatGPT 4 and it suggested something like this that seems reasonable:
Get it from the main server: SELECT * FROM pg_stat_replication, and the write_ls column has the log transaction location; Then get the location of the replication log and how much has been received: SELECT pg_last_wal_receive_lsn(); Then you can figure out the delta from any of these: SELECT pg_wal_lsn_diff(write_ls, pg_last_wal_receive_lsn()); or similar.
That seems like it isn't a hack.
This is just demo code, run these two short scripts to see a synchronising example, at least that's my reading.
//! Replicator prototype
//!
//! ** For demo use only!
And the configuration suggests it sends some data to https://us-east-1.mycelial.com [2] And that's not really explained anywhere I can see.I don't think the authors would currently suggest using it for anything real.
[1] https://github.com/mycelial/mycelite/blob/main/mycelite/src/...
[2] https://github.com/mycelial/mycelite/blob/main/mycelite/src/...
Every blocking operation needs an async variant. Everything should be async-first.
Languages Rust 100.0%
did the link change??