Class: Flipper::Adapters::Sync::Synchronizer

Inherits:
Object
  • Object
show all
Defined in:
lib/flipper/adapters/sync/synchronizer.rb

Overview

Public: Given a local and remote adapter, it can update the local to match the remote doing only the necessary enable/disable operations.

Instance Method Summary collapse

Constructor Details

#initialize(local, remote, options = {}) ⇒ Synchronizer

Public: Initializes a new synchronizer.

local - The Flipper adapter to get in sync with the remote. remote - The Flipper adapter that is source of truth that the local

adapter should be brought in line with.

options - The Hash of options.

:instrumenter - The instrumenter used to instrument.
:raise - Should errors be raised (default: true).
:cache_bust - Should cache busting be used for remote get_all (default: false).


21
22
23
24
25
26
27
# File 'lib/flipper/adapters/sync/synchronizer.rb', line 21

def initialize(local, remote, options = {})
  @local = local
  @remote = remote
  @instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
  @raise = options.fetch(:raise, true)
  @cache_bust = options.fetch(:cache_bust, false)
end

Instance Method Details

#callObject

Public: Forces a sync.



30
31
32
33
34
# File 'lib/flipper/adapters/sync/synchronizer.rb', line 30

def call
  @instrumenter.instrument("synchronizer_call.flipper") do
    Flipper::Adapters::ActorLimit.with_sync_mode { sync }
  end
end