Timer Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
In ASP.net (c#) I want to be able to send a request to a user i.e. flag a
status (lets say for example you have a
job allocated to you) and then if they have not acknowledged the job within
a set period of time i.e. 1 hour
that job is then reallocated to someone else. I guess i would add a row to
my DB table with a time stamp and then
1 hour later reallocate the job

I am using MySQL so timed triggers may not be a possibility, would this be
done as a windows service
where every n secs i scan the table comparing the time with the server time
and search for records with
the time equal to +1 hour?

Any suggestions would be gratefully appreciated
 
You can use another thread

public class IndexerSchedule
{
public static void Install(int interval)
{
ThreadStart myThreadDelegate = new
ThreadStart(IndexerSchedule.run);
Thread myThread = new Thread(myThreadDelegate);
myThread.Name = interval.ToString();
myThread.Start();
}

private static void run()
{
int interval = 0;
interval =
System.Convert.ToInt32(Thread.CurrentThread.Name);
if (interval>0)
{
while(true)
{
//Do what you want

// Pause Thread
Thread.Sleep(interval*1000);
}
}
}
}
 
Hi Richard:

I'd go with either a Windows Service, or even easier is to set up a
scheduled task in Windows. You can write a console mode application
that runs every x minutes and queries the database for jobs to
maintain.
 
It's not scalable if you are creating a thread per user - threads are
precious.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top