I want to use a queue for file uploads. Users can upload files. Each file will have around 500 rows. Now I want to implement this logic:
- Maximum of 5 files can be processed at the same time. The remaining files should be in the queue.
- Each file should have 5 processes, so 5 rows will be inserted into databases at the same time. Shortly, there are will be a maximum of 25 processes (5 processes in every 5 files).
Now I am adding all files to one queue. Files processing one by one. Shortly first-come, first out. 2nd file needs to wait to finish 1st file.
How can I implement this? Or do you have any other suggestions?