Hopefully someone can help me to look in the right direction for a solution to this issue I’ve come across during the design of a system.
I am creating an auction site in which the auction has a particular end date/time.
I have a .NET Timer displaying the remaining time to the user and when this countsdown it fires and event to update the back end SQL database to say the auction has completed and it informs the winning user and fires a CLOSE function.
How would you recommend doing this for auctions that aren’t physically open in a browser at the time so the Timer event never creates this CLOSE event.
Ideally I need to run something at the point in time when an auction closing time has passed?
Thanks
One option is to store in the database the date/time that the auction item ends/closes. Then, don’t worry about something reacting to it closing (timer in your case on the client) and updating it closed. What determines it’s closed is simply the fact that now > closed date/time.
EDIT:
In the comment below you stated you also need to send mail when an auction closes. If that’s the case, you need some sort of background processing to select all events that are closed and send mails. You can still define closed by storing a date time. That bg processing can select all events where now is greater than closed date and processed bit is false. Once you select those, put them in a durable queue (table in sql, azure queue etc…). Then have the background processing drain the queue. As it processes each item and sends mail, it updates the event as processed.
You have multiple options for background processing: