Click here to Skip to main content
15,914,163 members
Home / Discussions / C#
   

C#

 
AnswerRe: A service to process scheduled tasks Pin
#realJSOP29-Nov-10 4:50
professional#realJSOP29-Nov-10 4:50 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 5:21
musefan29-Nov-10 5:21 
GeneralRe: A service to process scheduled tasks Pin
#realJSOP29-Nov-10 6:00
professional#realJSOP29-Nov-10 6:00 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 6:09
musefan29-Nov-10 6:09 
AnswerRe: A service to process scheduled tasks Pin
Luc Pattyn29-Nov-10 5:01
sitebuilderLuc Pattyn29-Nov-10 5:01 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 5:33
musefan29-Nov-10 5:33 
AnswerRe: A service to process scheduled tasks Pin
Luc Pattyn29-Nov-10 6:35
sitebuilderLuc Pattyn29-Nov-10 6:35 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 6:43
musefan29-Nov-10 6:43 
GeneralRe: A service to process scheduled tasks Pin
Luc Pattyn29-Nov-10 6:52
sitebuilderLuc Pattyn29-Nov-10 6:52 
GeneralRe: A service to process scheduled tasks Pin
Huw Leonard30-Nov-10 5:42
Huw Leonard30-Nov-10 5:42 
GeneralRe: A service to process scheduled tasks Pin
Jason Christian30-Nov-10 12:20
Jason Christian30-Nov-10 12:20 
AnswerRe: A service to process scheduled tasks Pin
YannickJost29-Nov-10 21:49
YannickJost29-Nov-10 21:49 
AnswerRe: A service to process scheduled tasks Pin
Rob Philpott29-Nov-10 5:49
Rob Philpott29-Nov-10 5:49 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 6:00
musefan29-Nov-10 6:00 
GeneralRe: A service to process scheduled tasks Pin
Mycroft Holmes29-Nov-10 22:02
professionalMycroft Holmes29-Nov-10 22:02 
GeneralRe: A service to process scheduled tasks Pin
musefan29-Nov-10 22:30
musefan29-Nov-10 22:30 
AnswerRe: A service to process scheduled tasks Pin
PIEBALDconsult29-Nov-10 14:26
mvePIEBALDconsult29-Nov-10 14:26 
Trying to cycle every second is likely needless. I also wouldn't create a thread for each event.

I use a System.Timers.Timer for each of my Windows Services. For my Scheduler, I set it to poll every fifteen seconds (but it's configurable). When it cycles, it queries the database for any due tasks and executes them, be they reports or emails or Westminster Chimes or whatever. Sub-fifteen seconds ought to be timely enough for anyone, especially where email servers are concerned.

Also, each time the Service cycles it updates a timestamp in the database, so that I can tell that it's still cycling and not just hung up or dead.


One thought about sleeping for a future event is to sleep for only part of the time (90% for instance) and then sleep again until the duration is under some threshold.
AnswerRe: A service to process scheduled tasks Pin
adambl29-Nov-10 22:14
professionaladambl29-Nov-10 22:14 
GeneralRe: A service to process scheduled tasks Pin
hoernchenmeister30-Nov-10 0:09
hoernchenmeister30-Nov-10 0:09 
AnswerRe: A service to process scheduled tasks Pin
JasonPSage30-Nov-10 1:21
JasonPSage30-Nov-10 1:21 
GeneralRe: A service to process scheduled tasks Pin
musefan30-Nov-10 1:37
musefan30-Nov-10 1:37 
GeneralRe: A service to process scheduled tasks Pin
PIEBALDconsult30-Nov-10 2:15
mvePIEBALDconsult30-Nov-10 2:15 
GeneralRe: A service to process scheduled tasks Pin
musefan30-Nov-10 2:31
musefan30-Nov-10 2:31 
GeneralRe: A service to process scheduled tasks Pin
PIEBALDconsult30-Nov-10 18:10
mvePIEBALDconsult30-Nov-10 18:10 
AnswerRe: A service to process scheduled tasks Pin
Moreno Airoldi30-Nov-10 2:08
Moreno Airoldi30-Nov-10 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.