Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Fix task API creation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Krigpl committed Sep 20, 2019
1 parent e4b22ae commit 9a8d645
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions golem/task/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from golem.core import golem_async
from golem.core import common
from golem.core import simpleserializer
from golem.core.deferred import DeferredSeq
from golem.core.deferred import DeferredSeq, deferred_from_future
from golem.ethereum import exceptions as eth_exceptions
from golem.model import Actor
from golem.resource import resource
Expand Down Expand Up @@ -576,15 +576,13 @@ def create_task_api_task(self, task_params: dict, golem_params: dict):
@defer.inlineCallbacks
def init_task():
try:
self.requested_task_manager.init_task(task_id)
yield deferred_from_future(
self.requested_task_manager.init_task(task_id))
except Exception:
self.client.funds_locker.remove_task(task_id)
raise
else:
self.requested_task_manager.start_task(task_id)
# Dummy yield to make this function work with inlineCallbacks.
# To be removed when there are other yeilds in this function.
yield defer.Deferred()

# Do not yield, this is a fire and forget deferred as it may take long
# time to complete and shouldn't block the RPC call.
Expand Down

0 comments on commit 9a8d645

Please sign in to comment.