Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix exception on network node removal #1139

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion yapapi/services/service_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from types import TracebackType
from typing import TYPE_CHECKING, AsyncContextManager, List, Optional, Set, Tuple, Type, Union

import statemachine.exceptions
from typing_extensions import Final

if TYPE_CHECKING:
Expand Down Expand Up @@ -414,7 +415,11 @@ async def _worker(work_context: WorkContext) -> None:
raise
finally:
if network and service.network_node:
await network.remove_node(work_context.provider_id)
try:
await network.remove_node(work_context.provider_id)
except statemachine.exceptions.TransitionNotAllowed:
# no need to remove the node if the network is not there
pass
service._clear_network_node()
await self._job.engine.accept_payments_for_agreement(self._job.id, agreement.id)
await self._job.agreements_pool.release_agreement(agreement.id, allow_reuse=False)
Expand Down