Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure service remains healthy with rare messages. #974

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

rngcntr
Copy link
Collaborator

@rngcntr rngcntr commented Nov 13, 2023

Fixes #973

If the queue is empty and the MessageProcessingHealthCheck is executed, the service resets the health check's timeout. For this to work, the health check frequency should be less than the
MaxTimeSinceLastProcessedMessage.

Fixes #973

If the queue is empty and the `MessageProcessingHealthCheck` is executed,
the service resets the health check's timeout. For this to work, the
health check frequency should be less than the
MaxTimeSinceLastProcessedMessage.
@@ -20,6 +20,7 @@ public BackgroundTaskQueue(IMetricsFactory<BackgroundTaskQueue<T>>? metricsFacto
_elementsInQueue = metricsFactory?.CreateGauge("task_queue_enqueued_elements", "", false, "type")
?.WithLabels(typeof(T).Name);
_totalMessages = metricsFactory?.CreateCounter("total_messages", "", false, "type")?.WithLabels(typeof(T).Name);
LastDequeuedAt = DateTimeOffset.UtcNow;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd prefer to rather have this as the default value in line 59 instead of here as a new line in the constructor.

@rngcntr rngcntr merged commit c0b4bf8 into master Nov 21, 2023
@FlorianHockmann FlorianHockmann deleted the issue-973 branch November 22, 2023 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MessageProcessingHealthcheck fails for services that rarely receive messages.
2 participants