/// Return the search results.
///
/// If there are cached search results this skips the actual search.
Return the search results.
If there are cached search results this skips the actual search.
Return the search results . If there are cached search results this skips the actual search .
async fn cached_sentry_search(
        &self,
        query: SearchQuery,
        config: &Config,
    ) -> Result<Vec<SearchResult>, DownloadError> {
        // The Sentry cache index should expire as soon as we attempt to retry negative caches.
        let cache_duration = if config.cache_dir.is_some() {
            config
                .caches
                .downloaded
                .retry_misses_after
                .unwrap_or_else(|| Duration::from_secs(0))
        } else {
            Duration::from_secs(0)
        };
        if let Some((created, entries)) = self.index_cache.lock().get(&query) {
            if created.elapsed() < cache_duration {
                return Ok(entries.clone());
            }
        }
        log::debug!(
            "Fetching list of Sentry debug files from {}",
            &query.index_url
        );
        let entries = future_utils::retry(|| self.fetch_sentry_json(&query)).await?;
        if cache_duration > Duration::from_secs(0) {
            self.index_cache
                .lock()
                .put(query, (Instant::now(), entries.clone()));
        }
        Ok(entries)
    }
async fn cached_sentry_search ( & self , query : SearchQuery , config : & Config , ) -> Result < Vec < SearchResult > , DownloadError > { // The Sentry cache index should expire as soon as we attempt to retry negative caches. let cache_duration = if config . cache_dir . is_some ( ) { config . caches . downloaded . retry_misses_after . unwrap_or_else ( | | Duration :: from_secs ( 0 ) ) } else { Duration :: from_secs ( 0 ) } ; if let Some ( ( created , entries ) ) = self . index_cache . lock ( ) . get ( & query ) { if created . elapsed ( ) < cache_duration { return Ok ( entries . clone ( ) ) ; } } log :: debug ! ( " " query index_url ) ; let entries = future_utils :: retry ( | | self . fetch_sentry_json ( & query ) ) . await ? ; if cache_duration > Duration :: from_secs ( 0 ) { self . index_cache . lock ( ) . put ( query , ( Instant :: now ( ) , entries . clone ( ) ) ) ; } Ok ( entries ) }
Return the search results.
Return the search results .
&self
query
SearchQuery
config
&Config