diff --git a/crates/symbolicator-js/src/service.rs b/crates/symbolicator-js/src/service.rs index fcbc0da70..40f330038 100644 --- a/crates/symbolicator-js/src/service.rs +++ b/crates/symbolicator-js/src/service.rs @@ -27,7 +27,7 @@ impl SourceMapService { let caches = &services.caches; let shared_cache = services.shared_cache.clone(); let objects = services.objects.clone(); - let download_svc = services.downloader.clone(); + let download_svc = services.download_svc.clone(); let sourcefiles_cache = services.sourcefiles_cache.clone(); let bundle_index_cache = BundleIndexCache::new( @@ -36,7 +36,13 @@ impl SourceMapService { download_svc.clone(), ); - let api_lookup = todo!(); + let in_memory = &services.config.caches.in_memory; + let api_lookup = Arc::new(SentryLookupApi::new( + download_svc.trusted_client.clone(), + download_svc.runtime.clone(), + download_svc.timeouts, + in_memory, + )); Self { objects, diff --git a/crates/symbolicator-service/src/services/download/mod.rs b/crates/symbolicator-service/src/services/download/mod.rs index 3630a4ad7..4e05f4101 100644 --- a/crates/symbolicator-service/src/services/download/mod.rs +++ b/crates/symbolicator-service/src/services/download/mod.rs @@ -209,8 +209,9 @@ impl HostDenyList { /// rate limits and the concurrency it uses. #[derive(Debug)] pub struct DownloadService { - runtime: tokio::runtime::Handle, - timeouts: DownloadTimeouts, + pub runtime: tokio::runtime::Handle, + pub timeouts: DownloadTimeouts, + pub trusted_client: reqwest::Client, sentry: sentry::SentryDownloader, http: http::HttpDownloader, s3: s3::S3Downloader, @@ -231,6 +232,7 @@ impl DownloadService { Arc::new(Self { runtime: runtime.clone(), timeouts, + trusted_client: trusted_client.clone(), sentry: sentry::SentryDownloader::new(trusted_client, runtime, timeouts, in_memory), http: http::HttpDownloader::new(restricted_client.clone(), timeouts), s3: s3::S3Downloader::new(timeouts, in_memory.s3_client_capacity), diff --git a/crates/symbolicator-service/src/services/mod.rs b/crates/symbolicator-service/src/services/mod.rs index 91222b4d9..423ffb381 100644 --- a/crates/symbolicator-service/src/services/mod.rs +++ b/crates/symbolicator-service/src/services/mod.rs @@ -38,40 +38,42 @@ pub use self::symbolication::ScrapingConfig; pub use fetch_file::fetch_file; pub struct SharedServices { + pub config: Config, pub caches: Caches, - pub downloader: Arc, + pub download_svc: Arc, pub shared_cache: SharedCacheRef, pub objects: ObjectsActor, pub sourcefiles_cache: Arc, } impl SharedServices { - pub fn new(config: &Config, io_pool: tokio::runtime::Handle) -> Result { - let caches = Caches::from_config(config).context("failed to create local caches")?; + pub fn new(config: Config, io_pool: tokio::runtime::Handle) -> Result { + let caches = Caches::from_config(&config).context("failed to create local caches")?; caches - .clear_tmp(config) + .clear_tmp(&config) .context("failed to clear tmp caches")?; - let downloader = DownloadService::new(config, io_pool.clone()); + let download_svc = DownloadService::new(&config, io_pool.clone()); let shared_cache = SharedCacheService::new(config.shared_cache.clone(), io_pool); let sourcefiles_cache = Arc::new(SourceFilesCache::new( caches.sourcefiles.clone(), shared_cache.clone(), - downloader.clone(), + download_svc.clone(), )); let objects = ObjectsActor::new( caches.object_meta.clone(), caches.objects.clone(), shared_cache.clone(), - downloader.clone(), + download_svc.clone(), ); Ok(Self { + config, caches, - downloader, + download_svc, shared_cache, objects, sourcefiles_cache, diff --git a/crates/symbolicator-service/src/services/symbolication/mod.rs b/crates/symbolicator-service/src/services/symbolication/mod.rs index 8b9456899..c6b1ba64e 100644 --- a/crates/symbolicator-service/src/services/symbolication/mod.rs +++ b/crates/symbolicator-service/src/services/symbolication/mod.rs @@ -97,7 +97,7 @@ impl SymbolicationActor { let caches = &services.caches; let shared_cache = services.shared_cache.clone(); let objects = services.objects.clone(); - let download_svc = services.downloader.clone(); + let download_svc = services.download_svc.clone(); let sourcefiles_cache = services.sourcefiles_cache.clone(); let bitcode = BitcodeService::new(