Klowner / tussle

Tus daemon written in Typescript using a pluggable architecture
MIT License
37 stars 2 forks source link

Store write failures should result in 500 or 503 response #8

Open Klowner opened 1 year ago

Klowner commented 1 year ago

Right now the create handler returns a 400: Bad Request if there's a write failure by the storage service. Clients should not re-attempt requests that produce a 400, but in our case, the client should retry.

Consider responding to the client with a 500: Internal Server Error or 503: Service Unavailable.

(tus-js-client does not attempt to retry in the case of a 4xx response)

Klowner commented 1 year ago

tus-js-client's default shouldRetry method does not retry if the server response is 4xx (except for 409 and 423).

I think I'll add capabilities for storage services to return errors which signify whether or not the client should retry, essentially letting storage service signal temporary or fatal errors separately.

If the client should retry, we will return 503 Service Unavailable (which is the typical case for storage write failures, sometimes R2 is finicky and fails writes).