2

I have an asp.net website with a background service running that sends queued emails every minute. The problem is we moved to a web garden (multiple worker processes) and the emails get sent multiple times (at the very same time or close to it) because multiple threads are invoking that background process.

Is there a way to assign one thread or have only one thread run this process every minute and tell the other ones to ignore it?

Thanks!

chobo
  • 31,561
  • 38
  • 123
  • 191
  • Are you saying that multiple threads can send the same queued email? That seems like a bug in the queue-ing mechanism. Or are you saying that multiple threads can queue the same email? Need a little more detail here. – Jim Mischel Oct 03 '13 at 18:52
  • multiple threads can queue the same email. – chobo Oct 03 '13 at 21:44
  • What is you background service mechanism? Is it dedicated thread in w3wp.exe that checks DB for new tasks or NT serves like Quartz? – sh1ng Oct 18 '13 at 15:39

1 Answers1

0

I had to use mutex locking to prevent this

chobo
  • 31,561
  • 38
  • 123
  • 191