diff --git a/internal/uploads/intake.go b/internal/uploads/intake.go index ebc8b19..c1e3664 100644 --- a/internal/uploads/intake.go +++ b/internal/uploads/intake.go @@ -108,6 +108,14 @@ func (in *Intake) Accept(ctx context.Context, userID, title string, src io.Reade return "", fmt.Errorf("uploads: create: %w", err) } if err := in.sub.Submit(Job{UserID: userID, UploadID: id, Path: path, Duration: probe.Duration}); err != nil { + if errors.Is(err, ErrQueueFull) { + // The user's to retry, not a server fault: refuse it as such, and do not leave + // the row queued -- that is the stuck spinner. + if ferr := in.store.FailUpload(ctx, userID, id, domain.UploadErrBusy); ferr != nil { + return "", fmt.Errorf("uploads: submit: %w (and failing the row: %v)", err, ferr) + } + return "", &RejectError{Reason: ReasonBusy, Message: "Too many recordings are waiting to be transcribed. Please try again in a few minutes."} + } // A row that will never run must not sit queued: that is the stuck spinner. if ferr := in.store.FailUpload(ctx, userID, id, domain.UploadErrInterrupted); ferr != nil { return "", fmt.Errorf("uploads: submit: %w (and failing the row: %v)", err, ferr)