HathorNetwork / hathor-explorer-service

MIT License
1 stars 3 forks source link

fix: avoid concurrent data collectors #296

Closed luislhl closed 8 months ago

luislhl commented 8 months ago

Acceptance Criteria

We should make sure we won't run the DataCollector daemon's logic concurrently in the asyncio event loop.

Each execution should wait for the previous one to finish before starting.

The way we did it before left the possibility of having several async tasks in the event loop at once, in case they took more than 1 second to finish.

For instance, supposing each of them took 5 seconds to finish, we would have 5 tasks running concurrently.

By looking at the number of concurrent executions in the Lambda that is called by this daemon, we can see that sometimes we had even 9 concurrent executions:

image

I suspect this could be related to high memory consumption in the daemon, but I'm not 100% sure. The fix looked beneficial anyway.

Security Checklist