Reputation: 1633
I have an asp.net page that calls a dll that will start a long process that updates product information. As the process is running, I want to provide the user with constant updates on which product that process is on and the status of the products. I've been having trouble getting this to work. I add information to a log text file and I was thinking that I'd redirect to a new page and have that page use Javascript to read from the text file every few seconds. My question is has anyone else tried this and does it work fairly well?
Upvotes: 1
Views: 718
Reputation: 25649
Rather than outputting the status to a text based log file (or, in addition to using the log file; you can use both), you could output the status to a Database table. For example, structure the table as so:
Queue:
id (Primary Key)
user_id (Foreign Key)
product_id (Foreign Key) //if available
batch_size //total set of products in the batch this message was generated from
batch_remaining //number remaining in this batch
message
So now you have a queue. Now when a user goes on a particular page, you can do one of two things:
You can delete the rows from the Queue after they've been sent, or if you want to retain that data, add another column called sent
and set it to true
once the user has seen that data.
Upvotes: 0
Reputation: 11638
Upvotes: 0