pjongy / jasyncq Goto Github PK
View Code? Open in Web Editor NEWHigh reliability asynchronous task queue using mysql
License: MIT License
High reliability asynchronous task queue using mysql
License: MIT License
Sometime there should be gone in order of each tasks.
For example, B task should be done after A regardless any task is between them like :
A ..K(independent).. B(depends on A)
Prob.
jasyncq does not support their ordering and but multiple consumers are supported.
In this case, below situation could be occurred.
Sol.
It can be solved by save tasks with their pre-done task number like:
| task_id | queued_at | depends_on |
| A | 2021-01 | |
| K | 2021-02 | |
| B | 2021-03 | A |
and fetch query can be:
# Does not fetch if depends_on id remains in task queue
SELECT child.*
FROM queue_table as child
LEFT JOIN queue_table as parent
ON child.depends_on=parent.uuid
WHERE parent.uuid IS NULL;
Result rows' will be returned if dependent task is already done or independent task.
Executing just one query by joining all query list sql would be better than iterating for multiple queries. (It leass low performance.)
For example:
async def _execute(self, queries: List[str]):
async with self.pool.acquire() as conn:
conn: Connection = conn # NOTE(pjongy): For type hinting
async with conn.cursor() as cur:
cur: Cursor = cur # NOTE(pjongy): For type hinting
await cur.execute(';'.join(queries))
await conn.commit()
is better than it
jasyncq/jasyncq/repository/abstract.py
Lines 14 to 19 in c2d681b
as-is: exmple/main.py runs publish and pull
to-be separate pub.py and worker.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.