Implementing Priority Queues in Redis for Rust API Tasks - Glowing Telegram project - Episode 95

Channel:
Subscribers:
542
Published on ● Video Link: https://www.youtube.com/watch?v=qt4VNCcmLyw



Duration: 0:00
45 views
2


In this video, I work on enhancing our Glowing-Telegram project by implementing priority queues using Redis sorted sets. We kick off by revisiting the code from last session, focusing on setting up and refactoring various functions for task management. The main goal is to refine how tasks are queued, processed, and re-queued based on specific conditions like temporary errors or YouTube upload quotas being exceeded. Here's a breakdown of what we cover:

1. *Redis Sorted Sets for Priority Queues:* We discuss the implementation of a task system using Redis sorted sets to handle task prioritization based on a 'run after' timestamp. This involves abstracting the direct Redis connection calls and creating more sophisticated task handling mechanisms within our Rust code.
2. *Refactoring and Error Handling:* We spend a significant amount of time refactoring the code to improve readability and maintainability. This includes moving functions around, rewriting parts of the task worker logic, and adding error handling to ensure robustness.
3. *Practical Implementation:* I demonstrate how we handle the 'run after' feature, which determines when a task should be processed based on its priority score. We use Redis commands like `BZPOPMIN` to block and wait for the next available task, ensuring we respect the task priorities. We also cover how to handle errors returned from YouTube's API and re-queue tasks accordingly.
4. *Improving Task Queue Management:* We look at modifying the task worker to skip over tasks not yet ready to be run and implement custom logic to retry tasks after certain conditions are met. This involves learning about while loops, Rust's error handling, and how to translate timestamps into priority scores.
5. *Interactive Coding Session:* Throughout the session, there's live troubleshooting, real-time problem solving, and some interesting discoveries about Rust and Redis integration.

🔗 Check out my Twitch channel for more streams:   / saebyn  
GitHub: https://github.com/saebyn/glowing-tel...
Discord:   / discord  

Join me in this detailed coding session where we continue to push the boundaries of our project, making each aspect more efficient and scalable. Whether you're here to learn or just watch some Rust and Redis action, there's something for everyone!




Other Videos By saebynVODs


2024-09-11Automating YouTube Video Uploads with Rust and React-Admin | Glowing-Telegram Project - Episode 105
2024-09-10Fixing React-Admin Perf Issues + Enhancing Task Management | Glowing-Telegram Project - Ep 104
2024-09-09Debugging Rust APIs and Task Chaining in React-Admin | Glowing-Telegram Project - Episode 103
2024-09-08Solving Complex Querying and Asynchronous Tasks | Glowing Telegram Project - Episode 102
2024-09-07Fixing Stream Date Sorting in Rust APIs for React Admin | Glowing Telegram Project - Episode 101
2024-09-06Consolidated Rust-based API service part 3 | Glowing Telegram - Episode 100
2024-09-05Consolidating Rust APIs part 2 | Glowing Telegram - Episode 99
2024-09-04Consolidating Microservices in Rust | Optimizing Glowing Telegram Project - Episode 98
2024-09-03Improving YouTube Upload API with Rust for Glowing-Telegram Project - Episode 97
2024-09-02Priority Queues in Redis for Rust API Tasks Cont'd - Glowing Telegram project - Episode 96
2024-09-01Implementing Priority Queues in Redis for Rust API Tasks - Glowing Telegram project - Episode 95
2024-08-31Handling 503 Errors and Priority Queues in Rust | Glowing Telegram project - Episode 94
2024-08-30Handling API Quotas and Task Status in Rust - Glowing Telegram project - Episode 93
2024-08-29Handling API Quotas & Notifications in Rust and React-Admin | Glowing Telegram project - Episode 92
2024-08-28Debugging Notification Issues in React-Admin with Rust APIs | Glowing Telegram - Episode 91
2024-08-27Debugging Rust APIs w/ React-Admin Task Status Updates | Glowing Telegram project - Episode 90
2024-08-26Handling Task Status Updates in Rust APIs with React-Admin | Glowing-Telegram Project - Episode 89
2024-08-25More Real-time Notifications with Rust APIs and React-Admin | Glowing-Telegram Project - Episode 88
2024-08-24WebSockets for Real-Time Updates in Rust and React Admin | Glowing-Telegram Project - Episode 87
2024-08-23Building Real-Time Notifications w/ Rust & WebSockets | Glowing-Telegram Project - Episode 86
2024-08-22Implementing Dynamic Input with React-Admin | Glowing-Telegram Project - Episode 85