Safely optional #73

Closed
wants to merge 6 commits into
from

Projects

None yet

2 participants

@kennethkalmer
Owner

Based on some great feedback from @yorickpeterse, I'm making safely usage completely optional, albeit turned on by default.

The touchpoints were minor, so this should just work. Will play a bit a see before merging.

Feedback welcome.

/cc @marcbowes

@marcbowes
Collaborator

Tests? :-)

I think safely doesn't have to be a dev dependency.

@kennethkalmer
Owner

I made it a development dependency so I could flesh out the tests :)

Thanks for repremanding me ๐Ÿ‘

Making commit comments where the tests should be

@kennethkalmer kennethkalmer commented on the diff Sep 13, 2013
lib/daemon_kit/ruote_participants.rb
@@ -105,7 +105,8 @@ def run_amqp!
cmdq = mq.queue( q, :durable => true )
cmdq.subscribe( :ack => true ) do |header, message|
- safely do
+
+ receiver = lambda do |header, message|
@kennethkalmer
kennethkalmer Sep 13, 2013 Owner

Definitely needs specs as per @marcbowes instructions

@kennethkalmer kennethkalmer commented on an outdated diff Sep 13, 2013
lib/daemon_kit/initializer.rb
@@ -206,10 +204,17 @@ def include_core_lib
def configure_safely
Thread.abort_on_exception = true
- Safely::Strategy::Log.logger = DaemonKit.logger
+ if defined? Safely
@kennethkalmer
kennethkalmer Sep 13, 2013 Owner

Definitely needs specs as per @marcbowes instructions

@marcbowes
Collaborator

At the moment, Thread.abort_on_exception=true regardless of whether you have Safely or not. I think I agree with this, however this is done in the configure_safely method. I think you should rename this method to something else, e.g. configure_exception_handling, and then extract the safely stuff to configure_safely. You can then invoke that method if Safely is defined, ala configure_safely if safely_enabled?. The safely_enabled? method can be stubbed under test to return false for the case where you want to assert that it won't be configured when the gem isn't available. This is better than fiddling with constants at test time.

@kennethkalmer
Owner

๐Ÿ’ฏ times { ๐Ÿ‘ }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment