Sha256: dbd5077e4f54d421515c827175a68a6fd62e57cda2d12252f8903f30b6e29b1e
Contents?: true
Size: 1.17 KB
Versions: 21
Compression:
Stored size: 1.17 KB
Contents
# Worker used to clean up the queue deleting expired jobs module RestFtpDaemon class ConchitaWorker < Worker protected def worker_init # Load corker conf config_section :conchita # Check that everything is OK return "conchita disabled" if disabled?(@config[:timer]) return "invalid timer" unless @config[:timer].to_i > 0 return false end def worker_after # Sleep for a few seconds worker_status WORKER_STATUS_WAITING sleep @config[:timer] end def worker_process # Announce we are working worker_status WORKER_STATUS_CLEANING # Cleanup queues according to configured max-age RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_FINISHED, maxage(JOB_STATUS_FINISHED), @config[:debug] RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_FAILED, maxage(JOB_STATUS_FAILED), @config[:debug] RestFtpDaemon::JobQueue.instance.expire JOB_STATUS_QUEUED, maxage(JOB_STATUS_QUEUED), @config[:debug] # Force garbage collector GC.start if @config["garbage_collector"] end private def maxage status @config["clean_#{status}"] || 0 end end end
Version data entries
21 entries across 21 versions & 1 rubygems