⚡ Bolt: Implement dynamic concurrency in SharedDownloadQueue - #18
Conversation
Previously, SharedDownloadQueue would determine the concurrency level for a job at the start and maintain it throughout the job's lifecycle. If slots became available (e.g., another job finished), the running job would not scale up to utilize them. Conversely, if oversubscribed, it would not shed load effectively. This change introduces dynamic concurrency adjustment: - Inside the download loop, we now check `activeDownloadCount` against `maxConcurrentDownloads`. - If slots are available, we spawn additional tasks to fill them. - If we are oversubscribed, we naturally reduce concurrency by not replacing finished tasks (unless necessary to keep the job alive). This ensures better utilization of the download queue in batch processing scenarios.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
⚡ Bolt: Implement dynamic concurrency in SharedDownloadQueue
💡 What:
Implemented dynamic concurrency adjustment in
SharedDownloadQueue.downloadFiles. Instead of a fixed 1-in-1-out loop, we now check available slots after each download completes and spawn multiple tasks if capacity permits.🎯 Why:
To prevent resource underutilization. When multiple jobs run, or when one job finishes, remaining jobs were stuck at their initial concurrency level even if global slots became available. This change allows jobs to "burst" into available slots, maximizing throughput.
📊 Impact:
maxConcurrentDownloadsis fully utilized.🔬 Measurement:
Verified with
SharedDownloadQueueTests. While direct performance benchmarking requires a real network/Figma environment, the logic change ensuresactiveDownloadCounttends towardsmaxConcurrentDownloadsmore aggressively.PR created automatically by Jules for task 16895614716975194817 started by @alexey1312