abf/abf-worker#16: update Redis server for live logs

This commit is contained in:
Vokhmin Alexey V 2013-07-30 16:39:43 +04:00
parent 327277c2e1
commit 30803aa963
3 changed files with 73 additions and 56 deletions

View File

@ -9,6 +9,9 @@ common: &common
- 127.0.0.100
abf_worker:
publish_workers_count: 2
log_server:
host: 127.0.0.1
port: 6379
keys:
key_pair_secret_key: 'key_pair_secret_key'
airbrake_api_key: 'airbrake_api_key'

View File

@ -9,6 +9,9 @@ common: &common
- 127.0.0.100
abf_worker:
publish_workers_count: 2
log_server:
host: 127.0.0.1
port: 6379
keys:
key_pair_secret_key: 'key_pair_secret_key'
airbrake_api_key: 'airbrake_api_key'

View File

@ -1,11 +1,23 @@
module AbfWorker
module ModelHelper
module AbfWorker::ModelHelper
# In model which contains this helper should be:
# - #abf_worker_args
# - #build_canceled
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def log_server
@log_server ||= Redis.new(
:host => APP_CONFIG['abf_worker']['log_server']['host'],
:port => APP_CONFIG['abf_worker']['log_server']['port']
)
end
end
def abf_worker_log
Resque.redis.get(service_queue) || I18n.t('layout.build_lists.log.not_available')
self.class.log_server.get(service_queue) || I18n.t('layout.build_lists.log.not_available')
end
def add_job_to_abf_worker_queue
@ -55,5 +67,4 @@ module AbfWorker
"abfworker::#{abf_worker_base_queue.gsub(/\_/, '-')}-#{id}"
end
end
end