diff --git a/shard.yml b/shard.yml index 08ad417..402107c 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: tasker -version: 2.0.6 +version: 2.0.7 crystal: ">= 0.36.1" dependencies: diff --git a/spec/tasker_spec.cr b/spec/tasker_spec.cr index 68d8338..12c933a 100644 --- a/spec/tasker_spec.cr +++ b/spec/tasker_spec.cr @@ -188,25 +188,25 @@ describe Tasker do it "should pause and resume a repeating task" do sched = Tasker.instance run_count = 0 - task = sched.every(40.milliseconds) { run_count += 1; run_count } + task = sched.every(80.milliseconds) { run_count += 1; run_count } begin tasks << task - sleep 50.milliseconds + sleep 100.milliseconds run_count.should eq(1) - sleep 40.milliseconds + sleep 80.milliseconds run_count.should eq(2) task.cancel - sleep 40.milliseconds + sleep 80.milliseconds run_count.should eq(2) task.resume - sleep 50.milliseconds + sleep 100.milliseconds run_count.should eq(3) rescue error puts "\nfailed cancel running tasks\n#{error.inspect_with_backtrace}" diff --git a/src/tasker/timeout.cr b/src/tasker/timeout.cr index 9cff9fd..5e98d4f 100644 --- a/src/tasker/timeout.cr +++ b/src/tasker/timeout.cr @@ -7,8 +7,8 @@ class Tasker end def execute! - success = Channel(Output).new - failure = Channel(Exception).new + success = Channel(Output).new(1) + failure = Channel(Exception).new(1) if @same_thread fiber = Fiber.new { perform_action(success, failure) }