MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / startRefresh

Method startRefresh

internal/ui/components/app.go:101–107  ·  view source on GitHub ↗

startRefresh attempts to acquire the refresh guard. Returns (token, true) on success; (0, false) if another refresh is already in progress. The caller must pass the returned token to endRefresh when the refresh completes.

()

Source from the content-addressed store, hash-verified

99// Returns (token, true) on success; (0, false) if another refresh is already in progress.
100// The caller must pass the returned token to endRefresh when the refresh completes.
101func (a *App) startRefresh() (uint64, bool) {
102 token := uint64(time.Now().UnixNano()) | 1 // ensure nonzero
103 if a.refreshGen.CompareAndSwap(0, token) {
104 return token, true
105 }
106 return 0, false
107}
108
109// forceNewRefresh unconditionally acquires the refresh guard with a new token,
110// discarding any in-flight refresh. Old callbacks whose endRefresh calls will be

Callers 2

manualRefreshMethod · 0.95
autoRefreshDataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected