Skip to content

Commit

Permalink
Adding with_master and release_master! helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
kigster committed Jun 13, 2018
1 parent 7f6e9d0 commit a7c8b04
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
.idea/
13 changes: 13 additions & 0 deletions lib/makara/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ def stick_to_master!(persist = true)
Makara::Context.stick(@id, stickiness_duration)
end

def with_master
stick_to_master!
yield if block_given?
ensure
release_master!
end

def release_master!
if stuck_to_master?
Makara::Context.release(@id)
end
end

def strategy_for(role)
strategy_class_for(strategy_name_for(role)).new(self)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/makara/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VERSION

MAJOR = 0
MINOR = 4
PATCH = 0
PATCH = 1
PRE = nil

def self.to_s
Expand Down

0 comments on commit a7c8b04

Please sign in to comment.