fn get()

in ingester/lib/src/symbolicator/symbol_maps.rs [81:121]


    fn get(&self, key: cache::Key) -> Shared<LoadSymbolMap> {
        self.inner
            .lock()
            .unwrap()
            .entry(key.clone())
            .or_insert_with(|| {
                let manager = self.manager.clone();
                let location = Location {
                    key: key.clone(),
                    symindex: false,
                    cache_entry: self.job.register(key.clone(), self.channel),
                };
                LoadSymbolMap {
                    task_handle: tokio::spawn(async move {
                        // There's no need to explicitly hold the LiveEntry with the returned
                        // SymbolMap, because it stores the Location (including the LiveEntry)
                        // itself.
                        match manager
                            .load_symbol_map_from_location(location.clone(), None)
                            .await
                            .map(Arc::new)
                        {
                            // Errors while opening the file should be returned (because they
                            // may be due to network error); other errors are presumed to be
                            // caused by bad data (and thus couldn't be fixed by e.g.
                            // retrying).
                            Err(e @ samply_symbols::Error::HelperErrorDuringOpenFile { .. }) => {
                                return Err(e.into());
                            }
                            Err(e) => {
                                log::error!("failed to load symbol map for {location}: {e}");
                                Ok(None)
                            }
                            Ok(sm) => Ok(Some(sm)),
                        }
                    }),
                }
                .shared()
            })
            .clone()
    }