imranmomin / Hangfire.AzureCosmosDb

Azure Cosmos DB storage provider for Hangfire
https://www.hangfire.io/
MIT License
17 stars 16 forks source link

Queue priority order is ignored #27

Closed bzumhagen closed 2 years ago

bzumhagen commented 3 years ago

According to hangfire documentation, queue priority order should be able to be specified (either via alphanumeric order or array index)

See: https://docs.hangfire.io/en/latest/background-processing/configuring-queues.html

Current implementation just grabs the earliest enqueued job, regardless of queue.

See: https://github.com/imranmomin/Hangfire.AzureCosmosDb/blob/1ed52d4ff05c34ba11654ca20c27786bd2c2ee13/src/Queue/JobQueue.cs#L39

I think this could be resolved by ordering by queue name (alphanumeric desc) first, then ordering by enqueue time.

This would require a composite index.

bzumhagen commented 3 years ago

@imranmomin FYI I've opened a PR with a change that I think will enable this.

https://github.com/imranmomin/Hangfire.AzureCosmosDb/pull/28