Skip to content

Commit

Permalink
use spawn instead of delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen von Takach committed Aug 3, 2018
1 parent 76cb423 commit 9073706
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/promise.cr
Expand Up @@ -47,7 +47,7 @@ abstract class Promise
result = nil
promise = nil

delay(0) do
spawn do
begin
result = block.call
promise.not_nil!.resolve(result)
Expand Down
2 changes: 1 addition & 1 deletion src/promise/rejected_promise.cr
Expand Up @@ -13,7 +13,7 @@ class Promise::RejectedPromise(Input) < Promise::DeferredPromise(Input)
reason = @rejection

# Execute next tick
delay(0) do
spawn do
begin
ret = errback.call(reason)
result.resolve(ret)
Expand Down
2 changes: 1 addition & 1 deletion src/promise/resolved_promise.cr
Expand Up @@ -13,7 +13,7 @@ class Promise::ResolvedPromise(Input) < Promise::DeferredPromise(Input)
value = @value

# Execute next tick
delay(0) do
spawn do
begin
ret = callback.call(value)
if ret.is_a?(Promise)
Expand Down

0 comments on commit 9073706

Please sign in to comment.