I have an Asp.net MVC application running on AppHarbor. It has the everyday email ordering process:
- User enters their email and submits it.
- System processes order and sends out email with a link.
- User checks email and clicks the link to do the next step...
The thing is that between steps #2 and #3 a lot of time can pass. Some users check their emails immediately, others after a day or even later. The main thing is that enough time can pass that the application on the server ends.
So when the user clicks a link it may mean that they will have to wait for a bit for the application to start back up...
Question
When step #3 processes a record in database is updated with a timestamp (type is datetime
of course) when step #3 took place. But grok this: I can see records with completely identical timestamps! How can that even happen?
Timestamp gets generated in application layer and then pushes the updated to database. I'm using PetaPoco for data access.
What can cause multiple records to record the same time? My application has such small traffic that it actually does shut down sometimes during day so I find it hard to believe that multiple (up to three) users did step #3 at exactly the same time. And since this is running on a single process I suppose it's impossible...
What can be the cause for this?
Update code is really really simple
using (var db = this.DataContext)
{
db.Execute(Sql
.Builder
.Append("update dbo.SteppedProcess set Step3ProcessedOn = @0", DateTime.Now)
.Where("Step3ProcessedOn is null")
.Where("Id = @0", id));
}