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
[x] modify Model::sync to no longer panic. It should return the default Result type defined in this package. Probably Result<()>.
[x] get some tests in place for this.
[x] probably do a second critical review of the sync operation as a whole.
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 canpanic
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
Model::sync
to no longer panic. It should return the defaultResult
type defined in this package. ProbablyResult<()>
.