diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-01-26 11:08:44 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-01-26 11:08:44 -0800 |
| commit | ad2a20c8a5827461d07ab2a46932d0c1c89d1b37 (patch) | |
| tree | 951b46f31eb1d3fb2107efe062db99a1e99c10d1 /weed/command/filer_replication.go | |
| parent | 3a1d3d3413c5fc6a49c138ed5024f2b907f63d37 (diff) | |
| download | seaweedfs-ad2a20c8a5827461d07ab2a46932d0c1c89d1b37.tar.xz seaweedfs-ad2a20c8a5827461d07ab2a46932d0c1c89d1b37.zip | |
notification add ack and nack
Diffstat (limited to 'weed/command/filer_replication.go')
| -rw-r--r-- | weed/command/filer_replication.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go index 4f698e375..0b6eaf94e 100644 --- a/weed/command/filer_replication.go +++ b/weed/command/filer_replication.go @@ -97,13 +97,19 @@ func runFilerReplicate(cmd *Command, args []string) bool { replicator := replication.NewReplicator(config, "source.filer.", dataSink) for { - key, m, err := notificationInput.ReceiveMessage() + key, m, onSuccessFn, onFailureFn, err := notificationInput.ReceiveMessage() if err != nil { glog.Errorf("receive %s: %+v", key, err) + if onFailureFn != nil { + onFailureFn() + } continue } if key == "" { // long poll received no messages + if onSuccessFn != nil { + onSuccessFn() + } continue } if m.OldEntry != nil && m.NewEntry == nil { @@ -115,8 +121,14 @@ func runFilerReplicate(cmd *Command, args []string) bool { } if err = replicator.Replicate(context.Background(), key, m); err != nil { glog.Errorf("replicate %s: %+v", key, err) + if onFailureFn != nil { + onFailureFn() + } } else { glog.V(1).Infof("replicated %s", key) + if onSuccessFn != nil { + onSuccessFn() + } } } |
