BrighterCommand / Brighter

A framework for building messaging apps with .NET and C#.
https://www.goparamore.io/
MIT License
2.01k stars 256 forks source link

[Bug] PagedOutstandingCommand query in MySQL Outbox subtracts seconds instead of milliseconds, causing OutboxSweeper to function incorrectly #3134

Open romtur opened 3 months ago

romtur commented 3 months ago

Describe the bug

PagedOutstandingCommand query in MySQL Outbox subtracts seconds instead of milliseconds, causing OutboxSweeper to function incorrectly. This should be an easy fix.

To Reproduce

Set up the OutboxSweeper with MinimumMessageAge set to 5000 milliseconds (5 seconds)

image

The OutboxSweeper will dispatch messages that are older than 5000 seconds (instead of 5 seconds) due to an incorrect query:

public string PagedOutstandingCommand { get; } = "SELECT * FROM {0} WHERE DISPATCHED IS NULL AND Timestamp < DATE_ADD(UTC_TIMESTAMP(), INTERVAL -?OutStandingSince SECOND) ORDER BY Timestamp DESC LIMIT ?PageSize OFFSET ?OffsetValue";

Further technical details

iancooper commented 3 months ago

This may be fixed now, will check and fix if not

iancooper commented 2 months ago

We may fix this by looking to move our API from milliseconds to TimeSpan for clarity @preardon @holytshirt @dhickie in V10