mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-07 00:39:44 -06:00
In pubsub, skip replication work on same hash notification
This commit is contained in:
committed by
Dan Willhite
parent
500a33eb51
commit
996741a669
@@ -19,13 +19,18 @@ import (
|
||||
)
|
||||
|
||||
func Replicate(sub *floodsub.Subscription, source, dest datas.Dataset, didChange func(ds datas.Dataset)) {
|
||||
lastHash := ""
|
||||
for {
|
||||
dbg.Debug("looking for msgs")
|
||||
msg, err := sub.Next(context.Background())
|
||||
d.PanicIfError(err)
|
||||
h := hash.Parse(string(msg.Data))
|
||||
dbg.Debug("got update: %s from %s", h.String(), base64.StdEncoding.EncodeToString(msg.From))
|
||||
if lastHash == h.String() {
|
||||
continue
|
||||
}
|
||||
lastHash = h.String()
|
||||
|
||||
dbg.Debug("got update: %s from %s", h.String(), base64.StdEncoding.EncodeToString(msg.From))
|
||||
destDB := dest.Database()
|
||||
destDB.Rebase()
|
||||
dest = destDB.GetDataset(dest.ID())
|
||||
|
||||
Reference in New Issue
Block a user