lib/asynchronic.rb in asynchronic-3.0.3 vs lib/asynchronic.rb in asynchronic-4.0.0
- old
+ new
@@ -21,10 +21,12 @@
attr_config :data_store, DataStore::InMemory.new
attr_config :notifier, Notifier::InMemory.new
attr_config :logger, Logger.new($stdout)
attr_config :retry_timeout, 30
attr_config :garbage_collector_timeout, 30
+ attr_config :redis_client, Redic
+ attr_config :redis_settings, 'redis://localhost:6379'
attr_config :redis_data_store_sync_timeout, 0.01
attr_config :keep_alive_timeout, 1
attr_config :connection_name, "HOST=#{Socket.gethostname},PID=#{::Process.pid},UUID=#{SecureRandom.uuid}"
def self.environment
@@ -39,9 +41,15 @@
environment.processes
end
def self.garbage_collector
@garbage_collector ||= GarbageCollector.new environment, garbage_collector_timeout
+ end
+
+ def self.establish_redis_connection(options={})
+ redis_client = options.fetch(:redis_client, Asynchronic.redis_client)
+ redis_settings = options.fetch(:redis_settings, Asynchronic.redis_settings)
+ redis_client.new redis_settings
end
def self.retry_execution(klass, message)
begin
result = yield
\ No newline at end of file