We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de6c3a8 commit 9b07603Copy full SHA for 9b07603
canal/sync.go
@@ -213,7 +213,12 @@ func (c *Canal) updateTable(db, table string) (err error) {
213
return
214
}
215
func (c *Canal) updateReplicationDelay(ev *replication.BinlogEvent) {
216
- atomic.AddUint32(c.delay, uint32(time.Now().Unix())-ev.Header.Timestamp)
+ var newDelay uint32
217
+ now := uint32(time.Now().Unix())
218
+ if now >= ev.Header.Timestamp {
219
+ newDelay = now - ev.Header.Timestamp
220
+ }
221
+ atomic.StoreUint32(c.delay, newDelay)
222
223
224
func (c *Canal) handleRowsEvent(e *replication.BinlogEvent) error {
0 commit comments