s3: continuously listen to file updates

fix https://github.com/chrislusf/seaweedfs/issues/2342
This commit is contained in:
Chris Lu 2021-10-17 01:04:19 -07:00
parent 93bb7869b8
commit 71a8c80f6f

View file

@ -8,7 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
) )
func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, prefix string, lastTsNs int64) error { func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, prefix string, lastTsNs int64) {
processEventFn := func(resp *filer_pb.SubscribeMetadataResponse) error { processEventFn := func(resp *filer_pb.SubscribeMetadataResponse) error {
@ -32,8 +32,11 @@ func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, prefix string, la
return nil return nil
} }
return util.Retry("followIamChanges", func() error { util.RetryForever("followIamChanges", func() error {
return pb.WithFilerClientFollowMetadata(s3a, clientName, prefix, lastTsNs, 0, processEventFn, true) return pb.WithFilerClientFollowMetadata(s3a, clientName, prefix, lastTsNs, 0, processEventFn, true)
}, func(err error) bool {
glog.V(0).Infof("iam follow metadata changes: %v", err)
return true
}) })
} }