(r *logrepl.LogicalReplicator)
| 763 | } |
| 764 | |
| 765 | func waitForCaughtUp(r *logrepl.LogicalReplicator) error { |
| 766 | log.Println("Waiting for replication to catch up") |
| 767 | |
| 768 | start := time.Now() |
| 769 | for { |
| 770 | if caughtUp, err := r.CaughtUp(150); caughtUp { |
| 771 | log.Println("replication caught up") |
| 772 | break |
| 773 | } else if err != nil { |
| 774 | return err |
| 775 | } |
| 776 | |
| 777 | log.Println("replication not caught up, waiting") |
| 778 | if time.Since(start) >= 2*time.Second { |
| 779 | return errors.New("Replication did not catch up") |
| 780 | } |
| 781 | time.Sleep(20 * time.Millisecond) |
| 782 | } |
| 783 | |
| 784 | return nil |
| 785 | } |
no test coverage detected