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

Commit

Permalink
Merge pull request #7 from gini/replace_em
Browse files Browse the repository at this point in the history
Replace eventmachine with timers gem
  • Loading branch information
dkerwin committed Sep 22, 2014
2 parents 227f075 + ad6e198 commit 809abf3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions gini-api.gemspec
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|

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

spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake'
Expand All @@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'simplecov-rcov'
spec.add_development_dependency 'ci_reporter'
spec.add_development_dependency 'ci_reporter_rspec'
spec.add_development_dependency 'webmock'
spec.add_development_dependency 'coveralls'
end
16 changes: 8 additions & 8 deletions lib/gini-api/document.rb
@@ -1,4 +1,4 @@
require 'eventmachine'
require 'timers'

module Gini
module Api
Expand Down Expand Up @@ -57,14 +57,14 @@ def update(from_data = nil)
#
# @param [Float] interval API polling interval
#
def poll(interval)
EM.run do
EM.add_periodic_timer(interval) do
update
EM.stop if @progress =~ /(COMPLETED|ERROR)/
yield self if block_given?
end
def poll(interval, &block)
timers = Timers::Group.new
timers.every(interval) do
update
timers.cancel if @progress =~ /(COMPLETED|ERROR)/
yield self if block_given?
end
nil
end

# Indicate if the document has been processed
Expand Down
2 changes: 1 addition & 1 deletion lib/gini-api/version.rb
@@ -1,6 +1,6 @@
module Gini
module Api
# Package version
VERSION = "0.9.6"
VERSION = "0.9.7"
end
end

0 comments on commit 809abf3

Please sign in to comment.