Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Replace timers with simple until loop. Easier to use and really all w…
Browse files Browse the repository at this point in the history
…e need here
  • Loading branch information
dkerwin committed Sep 22, 2014
1 parent 809abf3 commit c89ffe7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion gini-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency 'oauth2'
spec.add_runtime_dependency 'logger'
spec.add_runtime_dependency 'timers', '~> 4.0.1'

spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake'
Expand Down
7 changes: 2 additions & 5 deletions lib/gini-api/document.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'timers'

module Gini
module Api

Expand Down Expand Up @@ -58,11 +56,10 @@ def update(from_data = nil)
# @param [Float] interval API polling interval
#
def poll(interval, &block)
timers = Timers::Group.new
timers.every(interval) do
until @progress =~ /(COMPLETED|ERROR)/ do
update
timers.cancel if @progress =~ /(COMPLETED|ERROR)/
yield self if block_given?
sleep(interval)
end
nil
end
Expand Down
2 changes: 1 addition & 1 deletion lib/gini-api/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Gini
module Api
# Package version
VERSION = "0.9.7"
VERSION = "0.9.8"
end
end

0 comments on commit c89ffe7

Please sign in to comment.