Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting item at a specific position in the queue #3

Open
logic-and-math opened this issue Dec 7, 2020 · 2 comments
Open

Inserting item at a specific position in the queue #3

logic-and-math opened this issue Dec 7, 2020 · 2 comments

Comments

@logic-and-math
Copy link

logic-and-math commented Dec 7, 2020

If i for example have five items remaining in the queue is there any way to insert a new future into for example a second position?
And thanks for the package, it's really useful!

@rknell
Copy link
Owner

rknell commented Dec 7, 2020

No not right now, but wouldn't be hard to fashion up. What is the use case for putting it second as opposed to executing it immediately.

I have thought about giving something a priority score in the past to ensure urgent tasks are completed first, ie the higher the number the sooner it gets executed, then gets executed by time. Is that what you were thinking about?

@logic-and-math
Copy link
Author

logic-and-math commented Dec 8, 2020

My use case is the following: I have an infinite scrolling list of posts. Each post can contain multiple images. When I load a batch of posts I put the first image of each post in the queue for download(so the first image downloads in the orders of the post). But when a user slides to a second image of a post, I would like to put all the other images of that post at the start of the queue(actually letting the currently running operation finish would be ideal). That is I want to avoid waiting for all the first images of other posts to download before downloading the rest of images of the selected post. If my explanation is confusing, I can draw something.
If I execute it immediately, then the bandwidth is split in 2 which I would like to avoid for the user experience.

@hffmnn hffmnn mentioned this issue Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants