chore(portforward): remove double log when clearing port forward file

This commit is contained in:
Quentin McGaw
2025-11-13 14:10:13 +00:00
parent cd6f9493a4
commit 3025476e8b
2 changed files with 5 additions and 3 deletions

View File

@@ -14,7 +14,11 @@ func (s *Service) writePortForwardedFile(ports []uint16) (err error) {
fileData := []byte(strings.Join(portStrings, "\n"))
filepath := s.settings.Filepath
s.logger.Info("writing port file " + filepath)
if len(ports) == 0 {
s.logger.Info("clearing port file " + filepath)
} else {
s.logger.Info("writing port file " + filepath)
}
const perms = os.FileMode(0o644)
err = os.WriteFile(filepath, fileData, perms)
if err != nil {

View File

@@ -59,8 +59,6 @@ func (s *Service) cleanup() (err error) {
s.ports = nil
filepath := s.settings.Filepath
s.logger.Info("clearing port file " + filepath)
err = s.writePortForwardedFile(nil)
if err != nil {
return fmt.Errorf("clearing port file: %w", err)