Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.
This repository was archived by the owner on Jul 7, 2026. It is now read-only.

Caution using this in production - scheduled emails creates many long running queries #141

Open

Description

@Recodify

I created a simple report based on a view. The view normally takes around 13secs with a select * from. When an email report is schedule, hangfire retries the job in the event of an exception. My db ground to a halt. Looking at the processes, I see lots of queries being run (presumably by hangfire).

image

I'm currently investigating the root cause of the email exception and also why the queries aren't being terminated on exception, but in the meantime, BE CAREFUL SCHEDULING AN EMAIL IN PRODUCTION

Activity

  1. harpsicord86 commented on Oct 29, 2022

    @harpsicord86

    Hi @Recodify,

    I think I may know what this is... Hangfire is designed to automatically retry the recurring job up to 10 times if it fails. You can change this by adding the following code to the top of the BuildScheduledEmail method of the ScheduledEmailManager:

    [AutomaticRetry(Attempts = 5)] [DisableConcurrentExecution(10 * 60)] public void BuildScheduledEmail(string queryName, string editUrl, string recipients, int queryId)
    This sets the retries to 5 and also turns off any jobs of the same type running concurrently (with a timeout of 10 minutes).
    Let me know if this works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions