Open cbeck88 opened 2 years ago
This is meant to be called from inside a transaction, e.g. https://github.com/mobilecoinfoundation/mobilecoin/blob/6825f2296b246cf7051e6c9750d61ac559e75663/fog/sql_recovery_db/src/lib.rs#L435
(and it does look like it is being called from inside one)
I guess you're right, it is being used correctly.
I might leave this open because I'm not sure it makes sense to update the last active at time when decommissioning
thanks for clearing this up
I noticed randomly a defect in the following code:
https://github.com/mobilecoinfoundation/mobilecoin/blob/6825f2296b246cf7051e6c9750d61ac559e75663/fog/sql_recovery_db/src/lib.rs#L161
This code marks an ingest invocation as decommissioned, and updates its "last active at" timestamp. But this happens in a separate diesel action from the one which adds the decommissioned event to the user events table.
If we lost connection to the DB in between, then the user event would never be written, which defeats the point of decommissioning this ingest invocation, since the users would still keep querying it, not knowing that it is decommissioned.
Ideally this would all be executed in one operation.
Separarely, I'm not sure it's necessary to change the "last active at" time, since marking something decommissioning may not really represent "activity".
We should check if there are other similar improvements that could be made in the fog db diesel code.