don't hardcode local port for backup and restore pprof service

If we hardcode a port, we can't run on a crowded machine, like in
CI. If we use :0, we can print the value actually picked.
This commit is contained in:
Seebs 2022-01-20 16:49:20 -06:00
parent d50065a16f
commit 375aaf8fbc
3 changed files with 3 additions and 3 deletions

View file

@ -60,7 +60,7 @@ func NewBackupCommand(stdin io.Reader, stdout, stderr io.Writer) *BackupCommand
CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr),
Concurrency: 1,
RetryPeriod: time.Minute,
Pprof: "localhost:43809",
Pprof: "localhost:0",
}
}

View file

@ -56,7 +56,7 @@ func NewRestoreCommand(stdin io.Reader, stdout, stderr io.Writer) *RestoreComman
CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr),
RetryPeriod: time.Second * 30,
Concurrency: 1,
Pprof: "localhost:43809",
Pprof: "localhost:0",
}
}

View file

@ -40,7 +40,7 @@ func startProfilingServer(addr string, logger logger.Logger) (close func() error
return nil, err
}
go func() {
logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", addr)
logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", ln.Addr().String())
logger.Printf("%v", s.Serve(ln))
}()