Skip to content

Commit

Permalink
feat: add redis mpush method
Browse files Browse the repository at this point in the history
  • Loading branch information
ihandmine committed Jul 7, 2022
1 parent 0b7fde2 commit a3aa558
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions aioscpy/queue/redis/_queue_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ async def push(self, request):
score = -request.get('priority', 1)
await self.server.zadd(self.key, {data: score})

async def mpush(self, requests: list):
async with self.server.pipeline() as pipe:
for request in requests:
data = self._encode_request(request)
score = -request.get('priority', 1)
pipe.zadd(self.key, {data: score})
await pipe.execute()

async def pop(self, timeout: int = 0) -> dict:
async with self.server.pipeline(transaction=True) as pipe:
results, count = await (
Expand Down

0 comments on commit a3aa558

Please sign in to comment.