Hello, i need to have some jobs scheduled in the background and executed at specific times. I wanted to make a worker who does that - and it works a little bit - but i had an enlightment... why not make bgdrb itself play that role? i mean, the MiddleMan has already everything needed! a timer thread, currently used only for deleting old workers and the workers itself. since im not familiar with threads, are ther some things i could break by adding a few options to backgroundrb.yml and a worker start in the MiddleMan#start_timer? or am i the only one who needs that so comiting it would be senseless? (but i dont think since i have at least two of my projects where i would need such a facility) and if so, how could the configuration be done? best would be something that can be changed and added by runtime while being preserved over various starts and stops... or something of rails magic: class FooWorker < BackgrounDRb::Rails repeat_every 24.hours start_at tomorrow.midnight def do_work @logger.info ''i will appear on midnight every day from now!'' end end but since thats magic, i dont really know how that would work, but its more the rails way than an entry in backgroundrb.yml i think what do you think of it? -- Michael Siebert <info at siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060801/965a5544/attachment.html
Take a look at rails_cron -- however, I''m with you in that you could probably combine these projects easily -- making backgroundrb the system of record. I''m not sure the state of rails_cron development these days. Configuration for rails_cron is a db table and a process that polls every minute. If you commit/patch, I''d be happy to test/contribute as well! -- Charles Brian Quinn self-promotion: www.seebq.com highgroove studios: www.highgroove.com slingshot hosting: www.slingshothosting.com On 8/1/06, Michael Siebert <info at siebert-wd.de> wrote:> Hello, > i need to have some jobs scheduled in the background and executed at > specific times. I wanted to make a worker who does that - and it works a > little bit - but i had an enlightment... why not make bgdrb itself play that > role? i mean, the MiddleMan has already everything needed! a timer thread, > currently used only for deleting old workers and the workers itself. since > im not familiar with threads, are ther some things i could break by adding a > few options to backgroundrb.yml and a worker start in the > MiddleMan#start_timer? or am i the only one who needs that so comiting it > would be senseless? (but i dont think since i have at least two of my > projects where i would need such a facility) > > and if so, how could the configuration be done? best would be something that > can be changed and added by runtime while being preserved over various > starts and stops... or something of rails magic: > > class FooWorker < BackgrounDRb::Rails > repeat_every 24.hours > start_at tomorrow.midnight > > def do_work > @logger.info ''i will appear on midnight every day from now!'' > end > end > > but since thats magic, i dont really know how that would work, but its more > the rails way than an entry in backgroundrb.yml i think > > what do you think of it? > > -- > Michael Siebert <info at siebert-wd.de> > > www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > >
Michael Siebert
2006-Aug-01 16:02 UTC
[Backgroundrb-devel] Fwd: [PATCH] making backgroundrb cron
damn i forgot to cc the list... (thanks charles for telling me) here it is ---------- Forwarded message ---------- From: Michael Siebert <info at siebert-wd.de> Date: 01.08.2006 17:27 Subject: [PATCH] making backgroundrb cron To: Charles Brian Quinn <me at seebq.com> It wasnt a too hard thing to do. Heres the Patch for vendor/plugins/backgroundrb/backgroundrb.rb You declare a worker to be a repetitive one by doing this in your worker class: class FooWorker < BackgrounDRb::Rails repeat 24.hours start_first tomorrow.midnight def do_work @ logger.info ''i will appear on midnight every day from now!'' end end now the task is started next midnight and repeated every 24 hours. start_first even takes "17:00" and stuff (everything Time#parse can parse).you should even be able to control thestart time and interval via the methods #next_start and #interval (they''re attr_accessors) for me its working perfectly, but a little bit of testing would sure be good did i mention that i love bgdrb more and more every day i find a new thing it can work out for me? -- Michael Siebert < info at siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -- Michael Siebert <info at siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060801/9b7948a1/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: bgdrbcron.patch Type: application/octet-stream Size: 2100 bytes Desc: not available Url : http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060801/9b7948a1/attachment.obj