fix(s3): handle storage outages and check bucket readiness
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
|
||||
"mtusi2026-messenger/internal/dto"
|
||||
s3store "mtusi2026-messenger/internal/s3"
|
||||
)
|
||||
|
||||
func WriteJSON(w http.ResponseWriter, status int, body any) {
|
||||
@@ -51,7 +52,7 @@ func WriteInternalError(w http.ResponseWriter, requestID string, err error) {
|
||||
}
|
||||
|
||||
func isUnavailable(err error) bool {
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, s3store.ErrUnavailable) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user