* overriding lock timeout for LonelyJobs
This commit is contained in:
parent
55850ae602
commit
3903822ca5
|
|
@ -30,6 +30,11 @@ module JamRuby
|
|||
"icecast-#{server_id}"
|
||||
end
|
||||
|
||||
def self.lock_timeout
|
||||
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
||||
60
|
||||
end
|
||||
|
||||
def self.perform(icecast_server_id)
|
||||
icecast = IcecastConfigWriter.new()
|
||||
icecast.icecast_server_id = icecast_server_id
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
require 'json'
|
||||
require 'resque'
|
||||
require 'resque-retry'
|
||||
require 'net/http'
|
||||
require 'digest/md5'
|
||||
|
||||
module JamRuby
|
||||
|
||||
# http://blog.bignerdranch.com/1643-never-use-resque-for-serial-jobs/
|
||||
# periodically scheduled to find sources that need to be brought down, or alternatively, it seems the client failed to start sourcing
|
||||
class IcecastSourceCheck
|
||||
|
||||
@queue = :icecast_source_check
|
||||
|
||||
@@log = Logging.logger[IcecastSourceCheck]
|
||||
|
||||
def self.perform
|
||||
@@log.debug("waking up")
|
||||
|
||||
# if we haven't seen updated_at be tickled in 5 minutes, but config_changed is still set to TRUE, this record has gotten stale
|
||||
IcecastMount.find_each(:conditions => "sourced_needs_changing_at < (NOW() - interval '#{APP_CONFIG.icecast_max_sourced_changed} second')", :batch_size => 100) do |server|
|
||||
server.with_lock do
|
||||
IcecastConfigWriter.enqueue(server.server_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@log.debug("done")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -8,11 +8,17 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find jobs that need retrying
|
||||
class AudioMixerRetry
|
||||
extend Resque::Plugins::LonelyJob
|
||||
|
||||
@queue = :audiomixer_retry
|
||||
|
||||
@@log = Logging.logger[AudioMixerRetry]
|
||||
|
||||
def self.lock_timeout
|
||||
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
||||
120
|
||||
end
|
||||
|
||||
def self.perform
|
||||
AudioMixer.queue_jobs_needing_retry
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,11 +8,17 @@ module JamRuby
|
|||
|
||||
# periodically scheduled to find jobs that need retrying
|
||||
class IcecastConfigRetry
|
||||
extend Resque::Plugins::LonelyJob
|
||||
|
||||
@queue = :icecast_config_retry
|
||||
|
||||
@@log = Logging.logger[IcecastConfigRetry]
|
||||
|
||||
def self.lock_timeout
|
||||
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
||||
120
|
||||
end
|
||||
|
||||
def self.perform
|
||||
@@log.debug("waking up")
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ module JamRuby
|
|||
|
||||
@@log = Logging.logger[IcecastSourceCheck]
|
||||
|
||||
def self.lock_timeout
|
||||
# this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
|
||||
120
|
||||
end
|
||||
|
||||
def self.perform
|
||||
@@log.debug("waking up")
|
||||
|
||||
|
|
@ -25,6 +30,7 @@ module JamRuby
|
|||
@@log.debug("done")
|
||||
end
|
||||
|
||||
|
||||
def run # if we haven't seen updated_at be tickled in 5 minutes, but config_changed is still set to TRUE, this record has gotten stale
|
||||
IcecastMount.find_each(lock: true, :conditions => "sourced_needs_changing_at < (NOW() - interval '#{APP_CONFIG.icecast_max_sourced_changed} second')", :batch_size => 100) do |mount|
|
||||
if mount.music_session_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue