Is this a good use for ThreadPool.QueueUserWorkItem?
- by Matt Grande
I have an application that, among other things, imports documents, then emails necessary parties to let them know that a document has been imported.
It turns out that determining whom to email, then performing the emailing, is what's taking the longest. I was thinking of doing something like this:
var document = ImportDocument();
ThreadPool.QueueUserWorkItem(s => SendEmail(document.Id));
return document;
... similar to DelayedJob in Rails, if that helps. Does that make sense in this context? What would you do?