DUP-GO-1: platform fan-out loop duplicated in handleSessions and handleSessionsNotify #44

Closed
opened 2026-05-27 16:57:10 +02:00 by dries · 1 comment
Owner

Summary

handleSessions (lines 26–101) and handleSessionsNotify (lines 133–180) in internal/server/handlers_sessions.go both contain an identical ~15-line loop that iterates over all registered platform adapters, calls adapter.Sessions(), collects results, and calls sortAndLimitSessions + applySessionState.

Fix

Extract a private gatherSessions(ctx, dir string, since, limit) helper covering the common loop. The two handlers then differ only in their post-gather steps (pinned force-include, summary projection).

Effort

Trivial.

## Summary `handleSessions` (lines 26–101) and `handleSessionsNotify` (lines 133–180) in `internal/server/handlers_sessions.go` both contain an identical ~15-line loop that iterates over all registered platform adapters, calls `adapter.Sessions()`, collects results, and calls `sortAndLimitSessions` + `applySessionState`. ## Fix Extract a private `gatherSessions(ctx, dir string, since, limit)` helper covering the common loop. The two handlers then differ only in their post-gather steps (pinned force-include, summary projection). ## Effort Trivial.
Author
Owner

Already fixed on main: handleSessions and handleSessionsNotify both delegate to the shared fanOutSessions helper (internal/server/fanout.go). Can be closed as done — see PR #220 for the remaining DUP-GO items.

Already fixed on main: handleSessions and handleSessionsNotify both delegate to the shared fanOutSessions helper (internal/server/fanout.go). Can be closed as done — see PR #220 for the remaining DUP-GO items.
dries closed this issue 2026-07-11 11:23:17 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dries/ocman#44
No description provided.