Because lastError is initialised to time.Now(), a full second must elapse before we'll print an error. If an error is returned at least once a second after that, we'll never print an error. Instead we can initialise lastError to the UNIX Epoch timestamp, meaning the first error we see will generate an error message.
The way the GUID is constructed should ensure that we never return an ID that is less than or equal than the previous ID. So add code to track that and return an error if we ever violate that condition.
without '*' expression of topic & channel, we can fetch results from map directly.
This moves to a single goroutine to process in-flight and deferred priority queues. It manages a pool of workers (configurable max) that process channels concurrently. It is a copy of redis's probabilistic algorithm that wakes up every 100ms to select a random 20 channels from a locally cached list (refreshed every 5s). If either of the queues had work to do the channel is considered "dirty". If 25% of the selected channels were dirty, the loop continues without sleep. For 1000 topics and channels with no clients connected - idle cpu usage dropped to ~8%.