- strprintf(FullQueueName, "%s%ld", AccessSchema.c_str(), randomQueue);
- if (Debug) {
- clog << "Chose random queue " << FullQueueName << " for " << Uri << endl;
+ if (cpuCount <= 0 || existing < cpuCount)
+ strprintf(FullQueueName, "%s%ld", AccessSchema.c_str(), existing);
+ else
+ {
+ long const randomQueue = random() % cpuCount;
+ strprintf(FullQueueName, "%s%ld", AccessSchema.c_str(), randomQueue);