MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / writeStoreErrorBusyAs

Function writeStoreErrorBusyAs

internal/server/server.go:3136–3156  ·  view source on GitHub ↗

writeStoreErrorBusyAs is writeStoreErrorR for the paths where the default busy wording would be untrue: a step that runs AFTER the main write committed (credentials changed, then the session refresh was busy) cannot say "nothing was saved". busyMessage replaces the wording; the status, code and Retr

(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string)

Source from the content-addressed store, hash-verified

3134// say "nothing was saved". busyMessage replaces the wording; the status, code
3135// and Retry-After are unchanged.
3136func writeStoreErrorBusyAs(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string) {
3137 if errors.Is(r.Context().Err(), context.Canceled) {
3138 // The client is gone, so the body is moot, but the status is still
3139 // recorded by logs and middleware: a header-only 503, never an
3140 // implicit 200 (a store call that failed is not a success).
3141 slog.Debug("request cancelled; store call abandoned", "error", err, "code", code)
3142 w.WriteHeader(http.StatusServiceUnavailable)
3143 return
3144 }
3145 if store.IsDBRetryable(err) {
3146 slog.Warn("database busy", "error", err, "code", code, "method", r.Method)
3147 if busyMessage != "" {
3148 writeBusyMessage(w, busyMessage)
3149 return
3150 }
3151 writeBusy(w, err, isWriteMethod(r.Method))
3152 return
3153 }
3154 slog.Error(message, "error", err, "code", code)
3155 writeError(w, status, code, message)
3156}
3157
3158// importPartiallyRemappedCode is the 500 code of a bundle import whose
3159// attachment-reference remap stopped between chunks (TASK-4278). The workspace

Callers 6

writeStoreErrorRFunction · 0.85
handleCreateWorkspaceMethod · 0.85
handleResetPasswordMethod · 0.85
writeMethod · 0.85

Calls 9

IsDBRetryableFunction · 0.92
writeBusyMessageFunction · 0.85
writeBusyFunction · 0.85
isWriteMethodFunction · 0.85
writeErrorFunction · 0.85
IsMethod · 0.45
ErrMethod · 0.45
WriteHeaderMethod · 0.45
ErrorMethod · 0.45

Tested by 1