Skip to content

Prefer Socket.gethostname with fallback to hostname command in hostname method#70

Merged
ichylinux merged 4 commits into
maedadev:mainfrom
Y-Asahi-dev:main
Jun 22, 2026
Merged

Prefer Socket.gethostname with fallback to hostname command in hostname method#70
ichylinux merged 4 commits into
maedadev:mainfrom
Y-Asahi-dev:main

Conversation

@Y-Asahi-dev

Copy link
Copy Markdown
Contributor

This PR updates the hostname method in Resque::Failure::JobAuditLog to:

  • Use Socket.gethostname as the primary way to retrieve the server name
  • Fallback to the hostname shell command if Socket.gethostname returns empty
  • Only memoize successful hostname values and avoid memoizing "(unknown)"

These changes improve reliability in environments where the hostname command may fail
(e.g., restricted PATH, missing binary, or containerized environments) and prevent
permanent "(unknown)" values from being cached in long-lived processes.

No other behavior changes are introduced.

@ichylinux ichylinux merged commit 88ab8ff into maedadev:main Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants