From b6dd48403e5dd1dc18f9efecec08a77ac169534e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 23 Sep 2026 17:07:02 -0700 Subject: [PATCH] filer.remote.sync: classify refused stamps by gRPC status only A FailedPrecondition substring in an unrelated error would have been swallowed as a skipped stamp; status.FromError already unwraps. --- weed/command/filer_remote_sync_dir.go | 6 ++---- weed/command/filer_remote_sync_dir_test.go | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.go index 7c040b575..1bf864f30 100644 --- a/weed/command/filer_remote_sync_dir.go +++ b/weed/command/filer_remote_sync_dir.go @@ -460,10 +460,8 @@ func isFailedPrecondition(err error) bool { if err == nil { return false } - if st, ok := status.FromError(err); ok && st.Code() == codes.FailedPrecondition { - return true - } - return strings.Contains(err.Error(), "precondition failed") + st, ok := status.FromError(err) + return ok && st.Code() == codes.FailedPrecondition } func isMultipartUploadFile(dir string, name string) bool { diff --git a/weed/command/filer_remote_sync_dir_test.go b/weed/command/filer_remote_sync_dir_test.go index 733b07719..5d45c0428 100644 --- a/weed/command/filer_remote_sync_dir_test.go +++ b/weed/command/filer_remote_sync_dir_test.go @@ -839,7 +839,7 @@ func TestIsFailedPrecondition(t *testing.T) { {"nil", nil, false}, {"status", refused, true}, {"wrapped status", fmt.Errorf("update entry: %w", refused), true}, - {"message only", errors.New("rpc error: code = FailedPrecondition desc = precondition failed: /f"), true}, + {"message only", errors.New("rpc error: code = FailedPrecondition desc = precondition failed: /f"), false}, {"other", status.Error(codes.Unavailable, "filer down"), false}, } for _, c := range cases {