-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update the Finalizer to reduce the frequency of heavy query #16132
Conversation
core/chains/evm/txmgr/finalizer.go
Outdated
// Attempts are cached and used for subsequent fetches to reduce the load of the query. | ||
// The attempts cache is refreshed every 3 requests. | ||
func (f *evmFinalizer) fetchAttemptsRequiringReceiptFetch(ctx context.Context) ([]TxAttempt, error) { | ||
f.attemptsCacheMu.Lock() |
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.
Is locking necessary?
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.
Probably not since the two calls that use the cache are sequential. I added it just in case there's any changes to it in the future since it's not obvious that this needs to be protected if it's called in a thread unsafe way. I'm probably getting ahead of myself though so I can remove it
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
0c797e3
to
e19ce6d
Compare
e19ce6d
to
2a245f7
Compare
|
Context
Increased DB load was noticed on CCIP prod testnet after upgrading to
2.20.0
. The culprit was a query used by the EVM TXM Finalizer component to fetch attempts requiring receipt fetch.Changes
The Finalizer was updated to maintain an attempts cache for receipt fetch. It will only fetch attempts from the transaction store every 6 heads and use the cache every other time. This change will help reduce the frequency that the query is called to reduce the DB load.