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

log messages going through msg_queue #5102

Merged
merged 1 commit into from
Feb 20, 2020
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
5 changes: 5 additions & 0 deletions golem/network/transport/msg_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from golem import decorators
from golem import model
from golem.core import variables
from golem.core.common import short_node_id


logger = logging.getLogger(__name__)
Expand All @@ -27,6 +28,8 @@
def put(node_id: str, msg: message.base.Message) -> None:
assert not isinstance(msg, FORBIDDEN_CLASSES),\
"Disconnect message shouldn't be in a queue"
logger.debug("saving into queue node_id=%s, msg=%r",
short_node_id(node_id), msg)
db_model = model.QueuedMessage.from_message(node_id, msg)
db_model.save()

Expand Down Expand Up @@ -62,6 +65,8 @@ def get(node_id: str) -> typing.Iterator['message.base.Base']:
continue
finally:
db_model.delete_instance()
logger.debug("got from queue node_id=%s, msg=%r",
short_node_id(node_id), msg)
yield msg


Expand Down