Two TickerQ runners on the same DB creates SQL errors #240
Replies: 6 comments
-
|
@MaxAllan-Smith did u use the latest version, v2.5.3? |
Beta Was this translation helpful? Give feedback.
-
|
@arcenox I did yes
|
Beta Was this translation helpful? Give feedback.
-
|
@arcenox If you are struggling to replicate the issue locally or if I am doing something wrong, I am available for a call |
Beta Was this translation helpful? Give feedback.
-
|
@MaxAllan-Smith The errors you’re seeing are already handled on the database side using commit/rollback transactions. The issue comes from EF Core itself, which raises errors that can’t simply be silenced — even though in practice they behave more like warnings. I’m currently working on releasing dedicated TickerQ builds for .NET 8 and later. These versions will leverage EF Core’s improved flexibility to handle these scenarios more cleanly and give us a better way to make the necessary adjustments. |
Beta Was this translation helpful? Give feedback.
-
|
@arcenox awesome, I'll keep my eye's peeled for the next release |
Beta Was this translation helpful? Give feedback.
-
|
@arcenox has there been any updates on this? Have you got a rough ETA for the next release? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Issue Description
I’ve set up
Program.cswithTickerQas follows:Note:
Job Class
I also have a simple job defined as:
The cron expression
"* * * * *"schedules it to run every minute.Problem
Error Logs
Here are the relevant parts of the error messages:
fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (2ms) [Parameters=[...]] INSERT INTO [ticker].[CronTickerOccurrences] (...) VALUES (...)fail: Microsoft.EntityFrameworkCore.Update[10000] An exception occurred in the database while saving changes for context type 'UcSmsService.Api.Data.ApplicationDbContext'. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes.Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'ticker.CronTickerOccurrences' with unique index 'UQ_CronTickerId_ExecutionTime'. The duplicate key value is (5be4f7dc-42fc-4a10-b5d9-679df89b0ca0, 2025-09-03 10:31:00.0000000). The statement has been terminated.warn: TickerQ.EntityFrameworkCore.Infrastructure.TickerEfCorePersistenceProvider[0] Constraint violation handled gracefully for CronTickerId=5be4f7dc-42fc-4a10-b5d9-679df89b0ca0, ExecutionTime=2025-09-03 10:31:00Summary
CronTickerOccurrences.This seems related to how TickerQ handles missed or overlapping occurrences when the app restarts quickly.
Extra Context
I consulted ChatGPT (GPT-5) about this issue.
The suggestion was that the problem could be tied to how
CancelMissedTickersOnAppStart()and occurrence seeding interact: when the app restarts mid-minute, TickerQ might try to re-insert the same scheduled occurrence, triggering the SQL unique constraint.Potential fix areas (according to ChatGPT’s analysis):
Beta Was this translation helpful? Give feedback.
All reactions