Class: Airbrake::RemoteSettings Private
- Inherits:
-
Object
- Object
- Airbrake::RemoteSettings
- Includes:
- Loggable
- Defined in:
- lib/airbrake-ruby/remote_settings.rb,
lib/airbrake-ruby/remote_settings/callback.rb,
lib/airbrake-ruby/remote_settings/settings_data.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
RemoteSettings polls the remote config of the passed project at fixed intervals. The fetched config is yielded as a callback parameter so that the invoker can define read config values. Supports proxies.
Defined Under Namespace
Classes: Callback, SettingsData
Constant Summary collapse
- QUERY_PARAMS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns metadata to be attached to every GET request.
URI.encode_www_form( notifier_name: Airbrake::NOTIFIER_INFO[:name], notifier_version: Airbrake::NOTIFIER_INFO[:version], os: RUBY_PLATFORM, language: "#{RUBY_ENGINE}/#{RUBY_VERSION}".freeze, ).freeze
- HTTP_OK =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'200'.freeze
Class Method Summary collapse
-
.poll(project_id, host) {|data| ... } ⇒ Airbrake::RemoteSettings
private
Polls remote config of the given project.
Instance Method Summary collapse
-
#initialize(project_id, host) {|data| ... } ⇒ RemoteSettings
constructor
private
A new instance of RemoteSettings.
-
#poll ⇒ self
private
Polls remote config of the given project in background.
-
#stop_polling ⇒ void
private
Stops the background poller thread.
Methods included from Loggable
Constructor Details
#initialize(project_id, host) {|data| ... } ⇒ RemoteSettings
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RemoteSettings.
42 43 44 45 46 47 48 |
# File 'lib/airbrake-ruby/remote_settings.rb', line 42 def initialize(project_id, host, &block) @data = SettingsData.new(project_id, {}) @host = host @block = block @config = Airbrake::Config.instance @poll = nil end |
Class Method Details
.poll(project_id, host) {|data| ... } ⇒ Airbrake::RemoteSettings
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Polls remote config of the given project.
35 36 37 |
# File 'lib/airbrake-ruby/remote_settings.rb', line 35 def self.poll(project_id, host, &block) new(project_id, host, &block).poll end |
Instance Method Details
#poll ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Polls remote config of the given project in background.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/airbrake-ruby/remote_settings.rb', line 53 def poll @poll ||= Thread.new do @block.call(@data) loop do @block.call(@data.merge!(fetch_config)) sleep(@data.interval) end end self end |
#stop_polling ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Stops the background poller thread.
69 70 71 |
# File 'lib/airbrake-ruby/remote_settings.rb', line 69 def stop_polling @poll.kill if @poll end |