Sha256: 000c21ba3a225f72ddca496729f2780bd916ec7d17931d50c2fe3b15e9c90b18
Contents?: true
Size: 1.16 KB
Versions: 38
Compression:
Stored size: 1.16 KB
Contents
require 'thread' require 'timeout' module SplitIoClient module Cache module Stores class SDKBlocker attr_reader :splits_repository attr_writer :splits_thread, :segments_thread def initialize(splits_repository, segments_repository) @splits_repository = splits_repository @segments_repository = segments_repository @splits_repository.not_ready! @segments_repository.not_ready! end def splits_ready! @splits_repository.ready! end def segments_ready! @segments_repository.ready! end def block begin Timeout::timeout(SplitIoClient.configuration.block_until_ready) do sleep 0.1 until ready? end rescue Timeout::Error fail SDKBlockerTimeoutExpiredException, 'SDK start up timeout expired' end SplitIoClient.configuration.logger.info('SplitIO SDK is ready') @splits_thread.run @segments_thread.run end def ready? @splits_repository.ready? && @segments_repository.ready? end end end end end
Version data entries
38 entries across 38 versions & 1 rubygems