-
Notifications
You must be signed in to change notification settings - Fork 1
/
locations_queue_worker.rb
47 lines (41 loc) · 1.33 KB
/
locations_queue_worker.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'rubygems'
require 'bundler/setup'
require 'dotenv'
Dotenv.load
require 'resque'
require 'redis'
require './config'
require './app/jobs/google_search_job'
require './app/jobs/yelp_search_job'
require './app/jobs/facebook_search_job'
require './app/jobs/foursquare_search_job'
require './app/jobs/google_identify_candidate_locations_job'
require './app/jobs/yelp_identify_candidate_locations_job'
require './app/jobs/google_fetch_and_associate_job'
require './app/jobs/yelp_fetch_and_associate_job'
require './app/jobs/foursquare_fetch_and_associate_job'
require './app/jobs/random_location_refresh_job'
require './app/jobs/random_location_audit_job'
module LocationFetchService
class LocationsQueueWorker < Resque::Worker
WAIT_INTERVAL = 10.0
RESQUE_LOCATIONS_QUEUE = "locations"
def initialize
super(RESQUE_LOCATIONS_QUEUE)
end
def work
super(WAIT_INTERVAL)
end
def self.run(redis)
STDOUT.puts "Starting locations queue worker on #{redis.inspect}"
::Resque.redis = redis
worker = LocationFetchService::LocationsQueueWorker.new
worker.verbose = worker.very_verbose = true
worker.work
end
end
end
if $0 == __FILE__
redis = ::Redis.new(host: LocationFetchService::DATABASE_HOST, password: ENV['REDIS_PASS'])
LocationFetchService::LocationsQueueWorker.run(redis)
end