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

Improve the load of store specs on local clusters #4177

Open
fraidev opened this issue Sep 12, 2024 · 0 comments
Open

Improve the load of store specs on local clusters #4177

fraidev opened this issue Sep 12, 2024 · 0 comments

Comments

@fraidev
Copy link
Contributor

fraidev commented Sep 12, 2024

Based on #4175 (comment) we should improve how we are loading store specs.

For now, we're creating or loading stores on the fly, like a cache:

fn get_store<S: Spec + DeserializeOwned>(&self) -> Result<Arc<SpecStore>> {
    let key = S::LABEL;
    let read = self.stores.read();
    Ok(match read.get(key) {
        Some(store) => store.clone(),
        None => {
            drop(read);
            let mut write = self.stores.write();
            let store = Arc::new(SpecStore::load::<S, _>(self.path.join(key))?);
            write.insert(key, store.clone());
            drop(write);
            store
        }
    })
}

@sehz said that a better approach would be to load all the specs first and remove this write lock from the get_store.

@fraidev fraidev changed the title Improve the load of specs on local clusters Improve the load of store specs on local clusters Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant