Skip to content

Conversation

@odesenfans
Copy link
Collaborator

Split the jobs.py file and put each separate job in its own
file. This simplifies the structure of the code.

Renamed the subprocesses for pending messages and txs to make
them similar.

@odesenfans
Copy link
Collaborator Author

Depends on #227.


def start_jobs(
config,
shared_stats: Dict,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a dict ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a dict. A proxy to a dict managed by a shared memory manager, but it behaves like a dict.


if (
pending["message"]["item_type"] == ItemType.IPFS
or pending["message"]["type"] == "STORE"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use aleph_message.models.MessageType.store ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'm going to create an additional PR with all your suggestions.


seen_ids: Dict[Tuple, int] = dict()
gtasks: List[asyncio.Task] = []
tasks: List[asyncio.Task] = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gtasks refers here to a list of created asyncio tasks, but tasks to a list of coroutines that have not been created/started. We could improve the naming.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I want gtasks to disappear though so that will solve the problem entirely.

messages = await get_chaindata_messages(
pending["content"], pending["context"], seen_ids=seen_ids
)
if isinstance(messages, list):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not if messages ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that would be too pythonic.

Split the `jobs.py` file and put each separate job in its own
file. This simplifies the structure of the code.

Renamed the subprocesses for pending messages and txs to make
them similar.
odesenfans added a commit to odesenfans/pyaleph that referenced this pull request Apr 26, 2022
Implemented two suggestions from the review of aleph-im#229.
@odesenfans odesenfans merged commit 206101f into aleph-im:dev Apr 26, 2022
@odesenfans odesenfans deleted the od-split-jobs branch April 26, 2022 10:05
odesenfans added a commit to odesenfans/pyaleph that referenced this pull request Apr 26, 2022
Implemented two suggestions from the review of aleph-im#229.
odesenfans added a commit that referenced this pull request Apr 26, 2022
Implemented two suggestions from the review of #229.
odesenfans added a commit that referenced this pull request Apr 27, 2022
Split the `jobs.py` file and put each separate job in its own
file. This simplifies the structure of the code.

Renamed the subprocesses for pending messages and txs to make
them similar.
odesenfans added a commit that referenced this pull request Apr 27, 2022
Implemented two suggestions from the review of #229.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants