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

Function isErrorTemporarilyUnavailable

internal/cache/badger_cache.go:135–149  ·  view source on GitHub ↗

isErrorTemporarilyUnavailable checks if an error is due to a resource being temporarily unavailable.

(err error)

Source from the content-addressed store, hash-verified

133
134// isErrorTemporarilyUnavailable checks if an error is due to a resource being temporarily unavailable.
135func isErrorTemporarilyUnavailable(err error) bool {
136 if err == nil {
137 return false
138 }
139
140 // Check if the error is EAGAIN or EWOULDBLOCK (resource temporarily unavailable)
141 if pathErr, ok := err.(*os.PathError); ok {
142 if errno, ok := pathErr.Err.(syscall.Errno); ok {
143 return errno == syscall.EAGAIN || errno == syscall.EWOULDBLOCK
144 }
145 }
146
147 // Also check the error string as a fallback
148 return err.Error() == "resource temporarily unavailable"
149}
150
151// Get retrieves data from the cache.
152func (c *BadgerCache) Get(key string, dest interface{}) (bool, error) {

Callers 1

NewBadgerCacheFunction · 0.85

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected