Hi,
Our app runs on 6 instances and every instance sends subscription expiring emails to customers i.e. 6 emails at once. How to stop this?
3 Answer(s)
-
0
Hi @ajayak
Those emails are sent using backgroudn workers. Background workers will be a problem when you urn more than 1 instance. It is better to enable background workers only on one instance and disable on others.
-
0
Hi @ismcagdas,
We use Hangfire for all our background jobs and Hangfire handles the concurrency very well :) But these background jobs use framework's job processing. Where can I configure this? Which file? :)
-
0
Hi,
This file is sending the emails, https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/MultiTenancy/SubscriptionExpireEmailNotifierWorker.cs
You can disable job execution as explained here https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers#disabling-job-execution but you need to get its value from a config file (appsettings.json maybe) amd set it to true only for one instance and set to false on other instances.