Class: SquashRepeater::Configuration
- Inherits:
-
Object
- Object
- SquashRepeater::Configuration
- Defined in:
- lib/squash_repeater/configure.rb
Defined Under Namespace
Classes: Squash
Instance Attribute Summary collapse
-
#capture_timeout ⇒ Object
Returns the value of attribute capture_timeout.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #backburner(&p) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#loggers ⇒ Object
Return an array of all available loggers.
- #squash(&p) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/squash_repeater/configure.rb', line 18 def initialize #NB: You definitely want to think about changing this to something more "substantial"; beanstalkd goes down, you'll lose data. self.logger = Logger.new(STDERR) self.capture_timeout = 2 # seconds backburner do |c| # The nature of SquashRepeater is that a tiny local queueing system # captures the Squash notification, and retransmits it from a worker. # Therefore, we assume beanstalkd is running locally: c.beanstalk_url = "beanstalk://localhost" #c.beanstalk_url = "beanstalk://127.0.0.1" c.tube_namespace = "squash-repeater" c.max_job_retries = 10 # retry jobs 10 times c.retry_delay = 30 # wait 30 seconds in between retries # NB: This relies on forking behaviour! # NB: Both ::Simple and ::Forking seem to have a bug in them (https://github.com/nesquena/backburner/issues/93) c.default_worker = Backburner::Workers::ThreadsOnFork #c.on_error = lambda { |ex| Airbrake.notify(ex) } #FUTURE: Choose a better failure mode: end end |
Instance Attribute Details
#capture_timeout ⇒ Object
Returns the value of attribute capture_timeout.
16 17 18 |
# File 'lib/squash_repeater/configure.rb', line 16 def capture_timeout @capture_timeout end |
#logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'lib/squash_repeater/configure.rb', line 15 def logger @logger end |
Instance Method Details
#backburner(&p) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/squash_repeater/configure.rb', line 42 def backburner(&p) if block_given? Backburner.configure(&p) else Backburner.configuration end end |
#loggers ⇒ Object
Return an array of all available loggers
59 60 61 |
# File 'lib/squash_repeater/configure.rb', line 59 def loggers [logger, backburner.logger] #FUTURE: Can we somehow get a Squash logger for this? end |
#squash(&p) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/squash_repeater/configure.rb', line 50 def squash(&p) if block_given? SquashRepeater::Configuration::Squash.configure(&p) else SquashRepeater::Configuration::Squash.configuration end end |