Original post

Hopefully this is not too dumb a question, apologies if it is.

I have a server with requests of different types arriving in various bursts in no order:

Event Time
A 1
A 2
A 3
B 4
B 5
A 6
C 7
C 8
B 9
C 10
C 11

I can process each event concurrently, but each event of the same time must be processed sequentially, FIFO. In other words the processing of events, per worker, must be:

A1 A2 A3 A6

B4 B5 B9

C7 C8 C10 C11

This can be done concurrently, so a worker can stop working on A3 to work on C7 then back to A6. But it cannot backwards in time, such as stop A3, to C9, then back C7, then back to A1.

I was looking at goque‘s Prefix Queue implementation, which states:

PrefixQueue is a FIFO (first in, first out) data structure that separates each given prefix into its own queue.

That sounds good on the queueing side, but I am having a very hard time finding modules or blog posts which implement the work pool side. Everything I see assumes that a pool should just grab whatever work is available, but I do not see an implementation of a pool where workers only process a task after the one right before it has finished.

Does what I am looking for make sense, and does such an implementation exist? TIA