سؤال

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!

هل كانت مفيدة؟

المحلول

I had to use mutex locking to prevent this

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top