Running task once a day in vibe.d
Chris Wright via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 16 14:09:11 PST 2016
On Tue, 16 Feb 2016 18:30:43 +0000, Nick wrote:
> Hey folks
>
> I'm making a vibe.d application. Once a day it needs to download some
> data. How do i get the program to perform this task once a day?
>
> Regards, Nick
http://vibed.org/api/vibe.core.core/runTask
http://vibed.org/api/vibe.core.core/sleep
Run a task in your application setup. Have it sleep until the appointed
time, then execute the job in accordance with the prophecy.
I'd have it run your daily job in a separate fiber for error isolation.
If you want to run it at particular times of day, run if the application
crashed before the appointed time, do the right thing with daylight
savings, execute once across multiple processes, etc, I don't think that
currently exists for vibe.d. It's a decent chunk of work to make all that
happen properly.
More information about the Digitalmars-d-learn
mailing list