Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Jun 27, 2024
1 parent cd6f3f0 commit 06cb085
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class MessageOutboxDeliveryService(
IRepository<OutboxMessage> messages,
IEnumerable<IOutboxMessageHandler> outboxMessageHandlers,
MessageOutboxOptions options,
IOptionsMonitor<MessageOutboxOptions> options,
ILogger<MessageOutboxDeliveryService> logger
) : BackgroundService
{
Expand All @@ -13,7 +13,8 @@ ILogger<MessageOutboxDeliveryService> logger

private readonly ILogger<MessageOutboxDeliveryService> _logger = logger;
protected TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(10);
protected TimeSpan MessageExpiration { get; set; } = TimeSpan.FromHours(options.MessageExpirationInHours);
protected TimeSpan MessageExpiration { get; set; } =
TimeSpan.FromHours(options.CurrentValue.MessageExpirationInHours);

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Expand Down
3 changes: 3 additions & 0 deletions src/SIL.Machine.Serval.EngineServer/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"ClearML": {
"BuildPollingEnabled": true
},
"MessageOutbox": {
"MessageExpirationInHours": 48
},
"Logging": {
"LogLevel": {
"System.Net.Http.HttpClient.Default": "Warning"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ public class TestMessageOutboxDeliveryService(
IRepository<OutboxMessage> messages,
IEnumerable<IOutboxMessageHandler> outboxMessageHandlers,
ILogger<MessageOutboxDeliveryService> logger
) : MessageOutboxDeliveryService(messages, outboxMessageHandlers, new MessageOutboxOptions(), logger)
)
: MessageOutboxDeliveryService(
messages,
outboxMessageHandlers,
Substitute.For<IOptionsMonitor<MessageOutboxOptions>>(),
logger
)
{
public async Task ProcessMessagesOnceAsync() => await ProcessMessagesAsync();

Expand Down

0 comments on commit 06cb085

Please sign in to comment.