(r *logrepl.LogicalReplicator)
| 923 | } |
| 924 | |
| 925 | func waitForCaughtUp(r *logrepl.LogicalReplicator) error { |
| 926 | log.Println("Waiting for replication to catch up") |
| 927 | |
| 928 | start := time.Now() |
| 929 | for { |
| 930 | if caughtUp, err := r.CaughtUp(150); caughtUp { |
| 931 | log.Println("replication caught up") |
| 932 | break |
| 933 | } else if err != nil { |
| 934 | return err |
| 935 | } |
| 936 | |
| 937 | log.Println("replication not caught up, waiting") |
| 938 | if time.Since(start) >= 30*time.Second { |
| 939 | return errors.New("Replication did not catch up") |
| 940 | } |
| 941 | time.Sleep(1 * time.Second) |
| 942 | } |
| 943 | |
| 944 | return nil |
| 945 | } |
no test coverage detected