Open logic-and-math opened 3 years ago
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?
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.
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!