-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix: Fix commit error on GraphQL service startup #1802
Changes from 9 commits
5d4d13d
ec4c1d6
dd1b580
5bfb69f
0696931
9aa90b1
c1c7c5c
8ed0ea5
d5315dd
3e7f7d9
5a0354c
ae1e4e4
43f6658
b229cd2
a3cff46
3d2880f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,10 +323,11 @@ where | |
_: &StateWatcher, | ||
_: Self::TaskParams, | ||
) -> anyhow::Result<Self::Task> { | ||
let mut db_tx = self.database.transaction(); | ||
let total_tx_count = db_tx.increase_tx_count(0).unwrap_or_default(); | ||
db_tx.commit()?; | ||
graphql_metrics().total_txs_count.set(total_tx_count as i64); | ||
{ | ||
let db_tx = self.database.transaction(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we aren't doing a commit here, do we still need a transaction? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, we don't, but it will require changing of constraints for the port=D I'm okay with using transaction for now to just fix the issue and release a new |
||
let total_tx_count = db_tx.get_tx_count().unwrap_or_default(); | ||
graphql_metrics().total_txs_count.set(total_tx_count as i64); | ||
} | ||
|
||
// TODO: It is possible that the node was shut down before we processed all imported blocks. | ||
// It could lead to some missed blocks and the database's inconsistent state. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to move it on one level upper. And reuse inside of the
increase_tx_count
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By one level up, do you mean the
Transactional
trait?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean reuse one constant in two functions=) Define it on file level instead of function level