Module: ConeyIsland
- Defined in:
- lib/coney_island.rb,
lib/coney_island/job.rb,
lib/coney_island/worker.rb,
lib/coney_island/version.rb,
lib/coney_island/performer.rb,
lib/coney_island/submitter.rb,
lib/coney_island/jobs_cache.rb,
lib/coney_island/job_argument_error.rb,
lib/coney_island/configuration_error.rb,
lib/coney_island/notifiers/base_notifier.rb,
lib/coney_island/notifiers/null_notifier.rb,
lib/coney_island/notifiers/bugsnag_notifier.rb,
lib/coney_island/notifiers/rollbar_notifier.rb,
lib/coney_island/notifiers/airbrake_notifier.rb,
lib/coney_island/notifiers/honeybadger_notifier.rb
Defined Under Namespace
Modules: Notifiers, Performer
Classes: ConfigurationError, Job, JobArgumentError, JobsCache, Submitter, Worker
Constant Summary
collapse
- VERSION =
"0.17.6"
Class Method Summary
collapse
Class Method Details
.amqp_connection ⇒ Object
8
9
10
|
# File 'lib/coney_island.rb', line 8
def self.amqp_connection
@connection
end
|
.amqp_parameters ⇒ Object
16
17
18
|
# File 'lib/coney_island.rb', line 16
def self.amqp_parameters
@amqp_parameters
end
|
.amqp_parameters=(params) ⇒ Object
12
13
14
|
# File 'lib/coney_island.rb', line 12
def self.amqp_parameters=(params)
@amqp_parameters = params
end
|
.cache_jobs ⇒ Object
102
103
104
|
# File 'lib/coney_island.rb', line 102
def self.cache_jobs
ConeyIsland::Submitter.cache_jobs
end
|
.cached_jobs ⇒ Object
106
107
108
|
# File 'lib/coney_island.rb', line 106
def self.cached_jobs
ConeyIsland::Submitter.cached_jobs
end
|
.caching_jobs(&blk) ⇒ Object
114
115
116
|
# File 'lib/coney_island.rb', line 114
def self.caching_jobs(&blk)
ConeyIsland::Submitter.caching_jobs(&blk)
end
|
.config ⇒ Object
66
67
68
|
# File 'lib/coney_island.rb', line 66
def self.config
ConeyIsland::Worker.config
end
|
.config=(config_hash) ⇒ Object
57
58
59
60
61
62
63
64
|
# File 'lib/coney_island.rb', line 57
def self.config=(config_hash)
self.amqp_parameters = config_hash.delete :amqp_connection
if !self.single_amqp_connection?
ConeyIsland::Submitter.amqp_parameters = config_hash.delete :amqp_connection_submitter
ConeyIsland::Worker.amqp_parameters = config_hash.delete :amqp_connection_worker
end
ConeyIsland::Worker.config=(config_hash)
end
|
.default_settings ⇒ Object
135
136
137
|
# File 'lib/coney_island.rb', line 135
def self.default_settings
{ work_queue: 'default', timeout: 30, delay: 0, highlander: false }
end
|
.delay_seed ⇒ Object
70
71
72
|
# File 'lib/coney_island.rb', line 70
def self.delay_seed
@delay_seed ||= 2
end
|
.delay_seed=(seed) ⇒ Object
74
75
76
|
# File 'lib/coney_island.rb', line 74
def self.delay_seed=(seed)
@delay_seed = seed
end
|
.flush_jobs ⇒ Object
118
119
120
|
# File 'lib/coney_island.rb', line 118
def self.flush_jobs
ConeyIsland::Submitter.flush_jobs
end
|
.initialize_background ⇒ Object
82
83
84
|
# File 'lib/coney_island.rb', line 82
def self.initialize_background
ConeyIsland::Worker.initialize_background
end
|
.notifier ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/coney_island.rb', line 40
def self.notifier
case self.config[:notifier]
when :rollbar
Notifiers::RollbarNotifier
when :airbrake
Notifiers::AirbrakeNotifier
when :bugsnag
Notifiers::BugsnagNotifier
when :honeybadger
Notifiers::HoneybadgerNotifier
when :none
Notifiers::NullNotifier
else
fail ConfigurationError, "#{self.config[:notifier]} is an invalid notifier. Valid options: :airbrake, :bugsnag, :honeybadger, :none"
end
end
|
.poke_the_badger(message, context = {}, attempts = 1) ⇒ Object
126
127
128
129
130
131
132
133
|
# File 'lib/coney_island.rb', line 126
def self.poke_the_badger(message, context = {}, attempts = 1)
self.notifier.notify(message, context)
rescue
if attempts <= 3
attempts += 1
retry
end
end
|
.run_inline ⇒ Object
90
91
92
|
# File 'lib/coney_island.rb', line 90
def self.run_inline
ConeyIsland::Submitter.run_inline
end
|
.running_inline? ⇒ Boolean
94
95
96
|
# File 'lib/coney_island.rb', line 94
def self.running_inline?
ConeyIsland::Submitter.running_inline?
end
|
.single_amqp_connection? ⇒ Boolean
78
79
80
|
# File 'lib/coney_island.rb', line 78
def self.single_amqp_connection?
!!self.amqp_parameters
end
|
.start_worker ⇒ Object
86
87
88
|
# File 'lib/coney_island.rb', line 86
def self.start_worker
ConeyIsland::Worker.start
end
|
.stop_caching_jobs ⇒ Object
110
111
112
|
# File 'lib/coney_island.rb', line 110
def self.stop_caching_jobs
ConeyIsland::Submitter.stop_caching_jobs
end
|
.stop_running_inline ⇒ Object
98
99
100
|
# File 'lib/coney_island.rb', line 98
def self.stop_running_inline
ConeyIsland::Submitter.stop_running_inline
end
|
.submit(*args) ⇒ Object
122
123
124
|
# File 'lib/coney_island.rb', line 122
def self.submit(*args)
ConeyIsland::Submitter.submit(*args)
end
|
.tcp_connection_retry_interval(retries) ⇒ Object
28
29
30
|
# File 'lib/coney_island.rb', line 28
def self.tcp_connection_retry_interval(retries)
self.tcp_connection_retry_seed ** retries
end
|
.tcp_connection_retry_limit ⇒ Object
24
25
26
|
# File 'lib/coney_island.rb', line 24
def self.tcp_connection_retry_limit
@tcp_connection_retry_limit ||= 6
end
|
.tcp_connection_retry_limit=(limit) ⇒ Object
20
21
22
|
# File 'lib/coney_island.rb', line 20
def self.tcp_connection_retry_limit=(limit)
@tcp_connection_retry_limit = limit
end
|
.tcp_connection_retry_seed ⇒ Object
36
37
38
|
# File 'lib/coney_island.rb', line 36
def self.tcp_connection_retry_seed
@tcp_connection_retry_seed ||= 2
end
|
.tcp_connection_retry_seed=(seed) ⇒ Object
32
33
34
|
# File 'lib/coney_island.rb', line 32
def self.tcp_connection_retry_seed=(seed)
@tcp_connection_retry_seed = seed
end
|