Return a 504 on timeout

Makes it obvious to the client when something took too long vs
when it errored.