thedodd / wither

An ODM for MongoDB built on the official MongoDB Rust driver.
https://docs.rs/wither
Other
325 stars 40 forks source link

Model::sync shouldn't panic. #3

Closed thedodd closed 6 years ago

thedodd commented 6 years ago

I originally coded it this way so that users could sync their models at boot time. In retrospect, this is pretty inflexible. It should return a standard Result and the user can panic if they want to.

This will also allow for APIs to boot, attempt a sync, and even if it fails, the service can continue to stay online and service calls. It could attempt another sync operation in the background as part of a "manager" type which controls access to the database connection.

todo