-
Notifications
You must be signed in to change notification settings - Fork 9
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
NDEV-3112. Optimize getting of deactivated features #566
base: develop
Are you sure you want to change the base?
NDEV-3112. Optimize getting of deactivated features #566
Conversation
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's incorrect to use CallDbClient::get_multiple_accounts
to get a list of accounts with features and then cache them because CallDbClient
works with the specific slot (and this time slot will be different for each CallDbClient instance).
Fortunatelly, features can be only enabled, and never disabled. So if we have activated features with a slot for the current time, we always can build a list of features activated at any previous slot. For this, it's enough to create a list of features whose activation time is None or more than the specified slot.
b1e279f
to
6062b31
Compare
23ef0b3
to
e8149cc
Compare
Dapps report |
Solana Requests Statistics
|
@@ -88,6 +89,6 @@ impl Rpc for CallDbClient { | |||
} | |||
|
|||
async fn get_deactivated_solana_features(&self) -> ClientResult<Vec<Pubkey>> { | |||
Ok(vec![]) // TODO | |||
get_deactivated_features(self, Some(self.slot)).await |
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.
You have to use CloneRpcClient
to get_deactivated_features or the logic of it will be broken.
} | ||
} | ||
|
||
static DEACTIVATED_FEATURES: Lazy<Arc<Mutex<DeactivatedFeaturesCache>>> = |
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.
Why don't you use RwLock
instead of Mutex
?
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.
Because we cannot call await of async function under lock of RwLock. In our case we need to call async Rpc::get_multiple_accounts
No description provided.