rc: disable the metrics server when running rclone rc

Fixes #8248
This commit is contained in:
hiddenmarten 2024-12-23 16:41:24 +01:00 committed by Nick Craig-Wood
parent dbb21165d4
commit 7c7606a6cf

View File

@ -429,11 +429,12 @@ func initConfig() {
fs.Fatalf(nil, "Failed to start remote control: %v", err)
}
// Start the metrics server if configured
_, err = rcserver.MetricsStart(ctx, &rc.Opt)
if err != nil {
fs.Fatalf(nil, "Failed to start metrics server: %v", err)
// Start the metrics server if configured and not running the "rc" command
if os.Args[1] != "rc" {
_, err = rcserver.MetricsStart(ctx, &rc.Opt)
if err != nil {
fs.Fatalf(nil, "Failed to start metrics server: %v", err)
}
}
// Setup CPU profiling if desired