MCPcopy Create free account
hub / github.com/JordanCoin/codemap / RunHookWithTimeout

Function RunHookWithTimeout

cmd/hooks.go:148–156  ·  view source on GitHub ↗

RunHookWithTimeout executes a hook with a hard timeout. On timeout, returns HookTimeoutError and callers should fail open.

(hookName, root string, timeout time.Duration)

Source from the content-addressed store, hash-verified

146// RunHookWithTimeout executes a hook with a hard timeout.
147// On timeout, returns HookTimeoutError and callers should fail open.
148func RunHookWithTimeout(hookName, root string, timeout time.Duration) error {
149 if timeout <= 0 {
150 return RunHook(hookName, root)
151 }
152
153 return runWithTimeout(hookName, timeout, func() error {
154 return RunHook(hookName, root)
155 })
156}
157
158func runWithTimeout(hookName string, timeout time.Duration, fn func() error) error {
159 if timeout <= 0 {

Callers 2

mainFunction · 0.92
TestHookTimeoutHelpersFunction · 0.85

Calls 2

RunHookFunction · 0.85
runWithTimeoutFunction · 0.85

Tested by 1

TestHookTimeoutHelpersFunction · 0.68