mirror of
https://github.com/games-on-whales/fenrir.git
synced 2026-10-15 12:51:53 +00:00
[PR #8] [operator] retry stream reconciliation and fix stale session tracking #9
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/fenrir#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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/games-on-whales/fenrir/pull/8
Author: @shrinedogg
Created: 6/13/2026
Status: 🔄 Open
Base:
main← Head:fix/session-stream-retry📝 Commits (1)
8400e83[operator] retry stream reconciliation and fix stale session tracking📊 Changes
4 files changed (+36 additions, -9 deletions)
View changed files
📝
go.mod(+2 -3)📝
go.sum(+0 -2)📝
pkg/controllers/session.go(+25 -3)📝
pkg/generic/controller.go(+9 -1)📄 Description
Problem
The session controller has two issues that surface as stalled sessions and endless log spam when running under Kubernetes.
1. Stream reconciliation is never retried.
ReconcilecallsreconcileActiveStreamsbut discards the result and returnsnil:During pod startup the session Deployment isn't ready and
wolf-agentisn't listening yet, soreconcileActiveStreamsfails withconnection refused/ "deployment not ready". Because the error is swallowed and no further informer event is guaranteed once the agent does come up, the stream is never started. The session sits idle until the 1-minute dead-session reaper deletes it, and Moonlight times out.2.
trackedSessionsis never cleaned up for sessions created after startup.Reconcileinserts intotrackedSessions, but only the startup path records the reversetrackedGamesmapping that the deletion branch relies on. So sessions created at runtime are never removed from tracking, and every later reconcile of the same user/game iterates the stale names and logs:forever.
Fix
Reconcileso the workqueue requeues with backoff and the stream is started as soon aswolf-agentbecomes reachable.workqueue.DefaultTypedControllerRateLimiter, but with the per-item max lowered from 1000s to 5s). Sessions only live ~1 minute before the reaper collects them, so retries must stay frequent to be useful.trackedGamesmapping on every reconcile (not just at startup), and defensively pruneNotFoundentries while building owner references so stale names self-heal instead of logging forever.Testing
go build ./...(native andGOOS=linux GOARCH=amd64) andgo test ./pkg/generic/...pass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.