Starts in:
1 DAY
14 HRS
43 MIN
57 SEC
Starts in:
1 D
14 H
43 M
57 S
Open Closed

Background Job is called multiple times when enqueued #2346


User avatar
0
Anjaneyulu created
  • ABP Framework version: v5.0.1

  • UI type: MVC

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): no

  • Exception message and stack trace:

  • Steps to reproduce the issue:"

  • Step 1. We are enqueuing the emails by calling in our code * await _backgroundJobManager.EnqueueAsync(new EmailArgs() { //Object });

But in the below "ExecuteAsync" is being called multiple times in our code.

public class NotificationSendingJob : AsyncBackgroundJob<EmailArgs >, ITransientDependency
{
        
        public NotificationSendingJob()
        {
            
        }
        [UnitOfWork]
        public override Task ExecuteAsync(EmailArgs args)
        {
           
                
                AsyncHelper.RunSync(() => SendNotification(args.TenantId, emailcontent));

                return Task.FromResult(0);
        }
}

We want to restrict it to single time.


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't reproduce the problem, can you share all steps to reproduce it?

  • User Avatar
    0
    Rajasekhar created

    Hi,

    I can't reproduce the problem, can you share all steps to reproduce it?

    We are sending an email in the ExecuteAsync method, so i doubt delay in sending email is triggering it multiple times.

    For test, Even if put a debug point on ExceuteAsync and wait for couple of seconds before continue i'm receiving multiple hits.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry I still can't reproduce, can you provide a simple project to me? shiwei.liang@volosoft.com thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06