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

Function writeStoreErrorBusyAs

internal/server/server.go:3229–3249  ·  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

3227// say "nothing was saved". busyMessage replaces the wording; the status, code
3228// and Retry-After are unchanged.
3229func writeStoreErrorBusyAs(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string) {
3230 if errors.Is(r.Context().Err(), context.Canceled) {
3231 // The client is gone, so the body is moot, but the status is still
3232 // recorded by logs and middleware: a header-only 503, never an
3233 // implicit 200 (a store call that failed is not a success).
3234 slog.Debug("request cancelled; store call abandoned", "error", err, "code", code)
3235 w.WriteHeader(http.StatusServiceUnavailable)
3236 return
3237 }
3238 if store.IsDBRetryable(err) {
3239 slog.Warn("database busy", "error", err, "code", code, "method", r.Method)
3240 if busyMessage != "" {
3241 writeBusyMessage(w, busyMessage)
3242 return
3243 }
3244 writeBusy(w, err, isWriteMethod(r.Method))
3245 return
3246 }
3247 slog.Error(message, "error", err, "code", code)
3248 writeError(w, status, code, message)
3249}
3250
3251// importPartiallyRemappedCode is the 500 code of a bundle import whose
3252// 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