ruma / homeserver

A Matrix homeserver written in Rust.
https://www.ruma.io/
1.08k stars 41 forks source link

Retrying failed transactions #148

Open jimmycuadra opened 7 years ago

jimmycuadra commented 7 years ago

Continued from #121.

When a database transaction fails, it might be a good idea to retry it. Some initial thoughts and questions:

  1. What are the most common reasons a transaction would fail?
  2. Do we want to retry all failed transactions or only when the failure was something we know has a possibility of working on another try (e.g. deadlocks)?
  3. What should the limit on the number of retries be?
  4. Should retry logic be part of application logic or encapsulated as part of the database layer itself? (I'm not sure if Diesel has any sort of automatic retrying feature that we might leverage, if we want to go for the latter.)