HangfireIO / HangfireIO/Hangfire
QueueAttribute not being persisted in database
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
Hi,
**_Setup:_**
Version of **Hangfire.Core 1.7.12**
Storage package: **Hangfire.PostgreSql 1.7.1**
**.net core 3.1**
I'm using the QueueAttribute as explained in the [DOCS](https://docs.hangfire.io/en/latest/background-processing/configuring-queues.html?highlight=queue)
And the worker is working correctly, picking up the correct job.
```
public interface IMyJob
{
[Queue("myQueue")]
Task ExecuteAsync(CancellationToken cancellationToken);
}
```
```
services.AddHangfireServer(options =>
{
options.Queues = new[] { "myQueue" };
});
```
```
recurringJobManager.AddOrUpdate(
"myjob",
job => job.ExecuteAsync(CancellationToken.None),
"*/1 * * * *")
```
However, the queue is not correctly persisted in the DB (it is persisting as Queue = `default` in the `hash` postgres table)
I can only solve that when I explicitly specify the queue name in the `AddOrUpdate` method:
```
recurringJobManager.AddOrUpdate(
"myjob",
job => job.ExecuteAsync(CancellationToken.None),
"*/1 * * * *",
"myQueue");
```
Is this normal behavior, or something I'm missing?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shown IMyJob interface and recurringJobManager.AddOrUpdate calls with Hangfire.Core 1.7.12 and Hangfire.PostgreSql 1.7.1. Inspect the resulting Queue value in the PostgreSQL hash table and compare the attribute-based call with the overload that explicitly supplies myQueue. Done means the attribute behavior is explained and, if incorrect, the queue is persisted without requiring the explicit argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100