From f665a63c4230f8de0a01e69cc6bf481dc85faa03 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 20 Nov 2025 17:04:55 -0800 Subject: [PATCH] refactor: remove unnecessary KeepMasterClientConnected wrapper in filer The Filer.KeepMasterClientConnected() method was an unnecessary wrapper that just forwarded to MasterClient.KeepConnectedToMaster(). This wrapper added no value and created inconsistency with other components that call KeepConnectedToMaster directly. Removed: filer.go:178-180 func (fs *Filer) KeepMasterClientConnected(ctx context.Context) { fs.MasterClient.KeepConnectedToMaster(ctx) } Updated caller: filer_server.go:181 - go fs.filer.KeepMasterClientConnected(context.Background()) + go fs.filer.MasterClient.KeepConnectedToMaster(context.Background()) Benefits: - Consistent with other components (S3, IAM, Shell, Mount) - Removes unnecessary indirection - Clearer that KeepConnectedToMaster runs in background goroutine - Follows the documented pattern from MasterClient.GetMaster() Note: shell/commands.go was verified and already correctly starts KeepConnectedToMaster in a background goroutine (shell_liner.go:51): go commandEnv.MasterClient.KeepConnectedToMaster(ctx) --- weed/filer/filer.go | 4 ---- weed/server/filer_server.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/weed/filer/filer.go b/weed/filer/filer.go index d3d2de948..b68004a8b 100644 --- a/weed/filer/filer.go +++ b/weed/filer/filer.go @@ -175,10 +175,6 @@ func (fs *Filer) GetMaster(ctx context.Context) pb.ServerAddress { return fs.MasterClient.GetMaster(ctx) } -func (fs *Filer) KeepMasterClientConnected(ctx context.Context) { - fs.MasterClient.KeepConnectedToMaster(ctx) -} - func (f *Filer) BeginTransaction(ctx context.Context) (context.Context, error) { return f.Store.BeginTransaction(ctx) } diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 79fb90742..3d08c0980 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -178,7 +178,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) fs.checkWithMaster() go stats.LoopPushingMetric("filer", string(fs.option.Host), fs.metricsAddress, fs.metricsIntervalSec) - go fs.filer.KeepMasterClientConnected(context.Background()) + go fs.filer.MasterClient.KeepConnectedToMaster(context.Background()) fs.option.recursiveDelete = v.GetBool("filer.options.recursive_delete") v.SetDefault("filer.options.buckets_folder", "/buckets")