Priority doesn't work ?
Created by: jbeaudoin11
Hi !
I'm having a hard time to understand how priorities work with the queue. I'm making a multimedia processing server, basically compression and resize stuff. So I have 3 queue : image, audio and video, but i'm focusing my test only on the image one for now.
The image queue has 2 types of job (for now), ResizeImage (priority: 1, high priority) and CompressImage (priority: 10, process "after" ResizeImage). I'm doing batch jobs so for each image those 2 jobs are added to the queue. I changed the order of how jobs are added to the queue and now it's by priority so for this case, every ResizeImage jobs are added before all CompressImage jobs.
So what i'm expecting to happen is that most of ResizeImage jobs are done first and after CompressImage jobs should be starting. But it just doesn't work like that at all :
ResizeImage 1629
ResizeImage 1628
ResizeImage 1630
ResizeImage 1631
ResizeImage 1635
ResizeImage 1634
ResizeImage 1633
ResizeImage 1632
CompressImage 1679
CompressImage 1678
CompressImage 1677
CompressImage 1676
CompressImage 1674
CompressImage 1675
CompressImage 1673
CompressImage 1672
CompressImage 1671
CompressImage 1670
CompressImage 1669
CompressImage 1668
CompressImage 1667
CompressImage 1666
CompressImage 1665
CompressImage 1664
CompressImage 1663
CompressImage 1662
CompressImage 1661
CompressImage 1660
CompressImage 1659
CompressImage 1658
CompressImage 1657
CompressImage 1656
ResizeImage 1653
ResizeImage 1652
CompressImage 1655
ResizeImage 1651
ResizeImage 1650
ResizeImage 1649
ResizeImage 1648
ResizeImage 1647
CompressImage 1654
ResizeImage 1646
ResizeImage 1645
ResizeImage 1643
ResizeImage 1644
ResizeImage 1642
ResizeImage 1641
ResizeImage 1640
ResizeImage 1639
ResizeImage 1638
ResizeImage 1637
ResizeImage 1636
This is base on the queue.on("completed", ..) event and with 4 workers. So i don't know how reliable that log is.
I don't think it matters, but that is a small sample size for fast testing, we will get prob 1000+ images by batches.. Also my nodejs server is on a VM with vagrant/virtualbox on ubuntu 16.04.