module BugsnagSourcemapUploader
BugsnagSourcemapUploader
is a library to enable parallel sourcemap uploads to Bugsnag.
Constants
- TASK_TIMEOUT_IN_SECONDS
- VERSION
Public Class Methods
upload(assets_metadata:, bugsnag_api_key:, http_options: {})
click to toggle source
Upload sourcemaps to Bugsnag.
@param assets_metadata [Array] object
Each item in this Array must be an object that responds to `#script_path`, `#source_map_path` and `#cdn_url`.
@param bugsnag_api_key [String] key
The Bugsnag API key.
@param http_options [Hash] HTTP options
Options accepted by HTTParty. Useful to set headers or logging details.
@return [BugsnagSourcemapUploader::Result] The object with the results of our operation.
# File lib/bugsnag_sourcemap_uploader.rb, line 24 def self.upload(assets_metadata:, bugsnag_api_key:, http_options: {}) pool = Concurrent::ThreadPoolExecutor.new( min_threads: [Concurrent.processor_count, 4].min, max_threads: Concurrent.processor_count ) futures = assets_metadata.map do |asset_metadata| Concurrent::Promise.execute(executor: pool) do UploadTask.new( asset_metadata: asset_metadata, bugsnag_api_key: bugsnag_api_key ).run(http_options) end end responses = futures.map do |future| future.value(TASK_TIMEOUT_IN_SECONDS) end Result.new(responses) end