Sha256: e085e8c62dfba9391e07c2c07c55293af77bd8e460aaf811a8e10535a327d903
Contents?: true
Size: 957 Bytes
Versions: 3
Compression:
Stored size: 957 Bytes
Contents
# Slight modifications from the default Resque tasks namespace :apn do task :setup task :work => :sender task :workers => :senders desc "Start an APN worker" task :sender => :setup do require 'apn' unless defined?(Resque) puts "This rake task is only for resque workers" return end APN.backend = :resque APN.password = ENV['CERT_PASS'] APN.full_certificate_path = ENV['FULL_CERT_PATH'] APN.logger = Rails.logger worker = ::Resque::Worker.new(APN::Jobs::QUEUE_NAME) puts "*** Starting worker to send apple notifications in the background from #{worker}" worker.work(ENV['INTERVAL'] || 5) # interval, will block end desc "Start multiple APN workers. Should only be used in dev mode." task :senders do threads = [] ENV['COUNT'].to_i.times do threads << Thread.new do system "rake apn:work" end end threads.each { |thread| thread.join } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
apn_sender-2.1.1 | lib/apn/tasks.rb |
apn_sender-2.1.0 | lib/apn/tasks.rb |
apn_sender-2.0.2 | lib/apn/tasks.rb |