mirror of
https://github.com/fosrl/newt.git
synced 2026-07-11 13:40:01 -05:00
[PR #370] [MERGED] fix: remove duplicate wrong error log in socket/fetch and dead code in reliablePing #5396
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/newt/pull/370
Author: @immanuwell
Created: 5/30/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @oschwartz10612
Base:
main← Head:fix/docker-fetch-duplicate-log-and-reliable-ping-dead-code📝 Commits (1)
d57b7ccfix: remove duplicate wrong error log in socket/fetch handler and dead code in reliablePing📊 Changes
2 files changed (+3 additions, -15 deletions)
View changed files
📝
common.go(+3 -11)📝
main.go(+0 -4)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
Two small bugs fixed:
1. Wrong log message in
newt/socket/fetchhandler (main.go)After
client.SendMessage("newt/socket/containers", ...)there were two back-to-backif err != nilchecks on the same var. The first one had a copy-pasted message from a different handler:"Failed to send registration message"-- totally wrong context. On any send error you'd see that bogus line logged first, then the correct one right after. Dropped the duplicate stale block, kept the one with the right message.2. Dead code in
reliablePing(common.go)successCountstarts at 0 and is only incremented once before theif successCount > 0guard -- so that condition is always true when reached. The function always returned there, making everything after the loop unreachable. Removed the always-true guard and the dead post-loop code, left the behavior identical.How to test?
Bug 1 -- check the
newt/socket/fetchhandler inmain.go. With the old code, any error fromclient.SendMessagewould log"Failed to send registration message"(wrong) followed by"Failed to send Docker container list"(right). Now only the correct line fires.Bug 2 -- static analysis or a quick read:
successCount++immediately beforeif successCount > 0guarantees the condition, making the post-loopif successCount == 0branch and finalreturnunreachable. Behavior is unchanged, code is just honest now.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.