mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 19:49:56 +00:00
The wasm client never runs the engine's session-warning flow, so linking the full sessionwatch package (timers, event composition) only bloats the binary. Put the watcher behind a sessionDeadlineWatcher interface and split the constructor by build tag: !js wires the real sessionwatch.Watcher, js gets a no-op stub that still mirrors the deadline into the status recorder (so the Status snapshot stays correct) but drops the timers. Removes the sessionwatch package from the wasm dependency graph.
17 lines
528 B
Go
17 lines
528 B
Go
//go:build !js
|
|
|
|
package internal
|
|
|
|
import (
|
|
"github.com/netbirdio/netbird/client/internal/auth/sessionwatch"
|
|
"github.com/netbirdio/netbird/client/internal/peer"
|
|
)
|
|
|
|
// newSessionWatcher returns the real SSO session expiry watcher for every
|
|
// non-wasm build. The js/wasm build gets a no-op stub from
|
|
// engine_sessionwatch_js.go so the sessionwatch package (and its timer
|
|
// machinery) never links into the wasm binary.
|
|
func newSessionWatcher(recorder *peer.Status) sessionDeadlineWatcher {
|
|
return sessionwatch.New(recorder)
|
|
}
|