Stop stops the replication process and blocks until clean shutdown occurs.
()
| 401 | |
| 402 | // Stop stops the replication process and blocks until clean shutdown occurs. |
| 403 | func (r *LogicalReplicator) Stop() { |
| 404 | r.mu.Lock() |
| 405 | if !r.running { |
| 406 | r.mu.Unlock() |
| 407 | return |
| 408 | } |
| 409 | r.mu.Unlock() |
| 410 | |
| 411 | log.Print("stopping replication...") |
| 412 | r.stop <- struct{}{} |
| 413 | // wait for the channel to be closed, acknowledging that the replicator has stopped |
| 414 | <-r.stop |
| 415 | } |
| 416 | |
| 417 | // replicateQuery executes the query provided on the replica connection |
| 418 | func (r *LogicalReplicator) replicateQuery(replicationConn *pgx.Conn, query string) error { |
no test coverage detected