I have a website that allows a user to upload a spreadsheet of items to a database. When the spreadsheet is uploaded it will be assessed for keywords that match individual user interests and email those users an alert to visit the website. However, when the spreadsheet is successfully uploaded the administrator needs to ftp into their server and upload any related images. This can take up to one hour to perform.
I will be executing the email alerts on a new thread and was wondering if, when that thread is called, I can safely call Thread.Sleep(360000) from within it to pause execution for one hour. Would this create a hog on the servers resources? If so is there another way to do this?
I can’t create a scheduled task as uploading can happen at any time/day of the week.
You can’t be 100% sure that your application pool won’t be recycled, your server rebooted, or any other number of events that could cause your thread to disappear out from under you.
You’ll have to have some form of scheduled task, that checks for “things older than X” and runs every minute/couple of minutes and processes any as that approach will allow you to recover from pretty much anything (eg. Server looses power for an hour, your scheduled task catches up on all email alerts that should have happened during that time).