Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Добавляем в Базу редиса
- export async function setQueue(this: Service, queueName, payload) {
- return this.fileDownloadQueue.rpush(queueName, JSON.stringify(payload));
- }
- Достаём из базы
- const queueData: QueueData | null = JSON.parse(
- await this.fileDownloadQueue.lpop('downloadQueue'),
- );
- Посмотреть очередь
- async handler(ctx: Context) {
- const { page = 1, pageSize = 10 } = ctx.params;
- const toIndex = page * pageSize - 1;
- const fromIndex = toIndex - pageSize;
- return this.fileDownloadQueue.lrange('downloadQueue', fromIndex, toIndex);
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement