Click here to Skip to main content
15,891,423 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: A service to process scheduled tasks Pin
Jan Limpens30-Nov-10 5:14
Jan Limpens30-Nov-10 5:14 
AnswerRe: A service to process scheduled tasks Pin
ely_bob30-Nov-10 7:14
professionalely_bob30-Nov-10 7:14 
AnswerRe: A service to process scheduled tasks Pin
MattPenner30-Nov-10 8:37
MattPenner30-Nov-10 8:37 
Questionduplicate email problem Pin
Tridip Bhattacharjee29-Nov-10 1:45
professionalTridip Bhattacharjee29-Nov-10 1:45 
AnswerRe: duplicate email problem Pin
Sebastien T.29-Nov-10 1:52
Sebastien T.29-Nov-10 1:52 
AnswerRe: duplicate email problem Pin
Keith Barrow29-Nov-10 2:03
professionalKeith Barrow29-Nov-10 2:03 
AnswerRe: duplicate email problem Pin
RaviRanjanKr29-Nov-10 4:19
professionalRaviRanjanKr29-Nov-10 4:19 
GeneralRepeat Pin
Not Active29-Nov-10 5:09
mentorNot Active29-Nov-10 5:09 
QuestionMessage Removed Pin
29-Nov-10 1:01
ArtOfScience29-Nov-10 1:01 

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.