Skip to content

Commit

Permalink
update to tasker 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jul 8, 2020
1 parent ebdd481 commit be4b507
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: promise
version: 2.2.0
version: 2.2.1

dependencies:
tasker:
github: spider-gazelle/tasker
version: ~> 2.0

development_dependencies:
ameba:
Expand Down
4 changes: 2 additions & 2 deletions src/promise.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class Promise
{% if timeout %}
begin
%promise = ::Promise::DeferredPromise({{type.id}}).new
%task = Tasker.instance.in({{timeout}}) { %promise.reject(::Promise::Timeout.new("operation timeout")) }
%task = Tasker.in({{timeout}}) { %promise.reject(::Promise::Timeout.new("operation timeout")) }
%promise.finally { %task.cancel }
%promise
end
Expand All @@ -42,7 +42,7 @@ abstract class Promise
}.execute!

{% if timeout %}
%task = Tasker.instance.in({{timeout}}) { %promise.reject(::Promise::Timeout.new("operation timeout")) }
%task = Tasker.in({{timeout}}) { %promise.reject(::Promise::Timeout.new("operation timeout")) }
%promise.finally { |err| %task.cancel unless err.is_a?(::Promise::Timeout) }
%promise
{% end %}
Expand Down

0 comments on commit be4b507

Please sign in to comment.