Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose DB transaction mechanism #17

Closed
mempirate opened this issue Jan 10, 2025 · 0 comments
Closed

Expose DB transaction mechanism #17

mempirate opened this issue Jan 10, 2025 · 0 comments
Assignees
Labels

Comments

@mempirate
Copy link
Contributor

Various parts in the codebase require atomicity:

// TODO: retries on transient faults (e.g. network errors)
// TODO: use a DB transaction here
if let Err(e) = self.db.register_validators(&registrations).await {
error!(error = ?e, "Failed to register validators in the database");
}
for operator in operators.into_values() {
if let Err(e) = self.db.register_operator(operator).await {
error!(error = ?e, "Failed to register operator in the database");
}
}
}

// TODO: retries on transient faults (e.g. network errors)
// TODO: ideally all DB operation in an epoch transition need to be made
// in a single transaction to avoid partial updates in case of failure
self.db.update_sync_state(state).await?;

We should expose a transaction mechanism at the correct level of abstraction.

@mempirate mempirate self-assigned this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant