Closed (fixed)
Project:
Poormanscron
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
27 Sep 2009 at 19:23 UTC
Updated:
14 Oct 2009 at 21:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
dave reidComment #2
dave reidIncluding tests!
Comment #3
robloachIncluding tests?! Damn skippy! Think we should wait for #566494: Running cron in a shutdown function breaks the site to go through? Still not entirely sure what solution will end up going through. Either way, this is still good for an initial testing DRUPAL-6--2!
Comment #4
dave reidSeems like #566494: Running cron in a shutdown function breaks the site is going to have a lot of objectors, but I really really like that approach. Plus, I don't think we can do the
<noscript>solution since we don't have a hook_page_alter() in D6. Revised patch that passes all tests and tested locally.Comment #5
sunhm?
Constants have to be in the namespace of the defining module. It doesn't matter whether this is a backport.
Please don't. Defined constants are irreversible, and modules are loaded sequentially. Use time() instead.
I'm on crack. Are you, too?
Comment #6
dave reidOh, yeah, I should take out the alert. But at least I can see it's working. :) Removed the DRUPAL_CRON_DEFAULT_THRESHOLD constant. Begrudgenly removing REQUEST_TIME because the performance implications of calling time() multiple times. I just reworked poormanscron_run_cron_check() to call time() once and re-use the result.
Comment #7
sunGreat - though you missed to remove the constant.
btw, time() can be called thousands of times before it starts to have any measurable performance impact.
The reason for introducing REQUEST_TIME was a different one.
This review is powered by Dreditor.
Comment #8
dave reidHah, thanks. :) Really appreciate the reviews.
Comment #9
sunComment #10
dave reid6.x-2.0 branch created and now using this code. Thanks everyone!
Comment #11
mikeytown2 commentedQuick question, does this embed the cron ajax/image callback for every page? or does it only inject it when cron is needed. Thinking about page caching and how this would effect it. I would prefer it was embedded in every page; maybe make it an option for people wanting it either way.
Comment #12
dave reidThe way it works is it injects a JavaScript variable timestamp for when the next cron run should happen, along with poormanscron.js which tests if the current time is greater than the 'target' timestamp, then it creates the ajax request to run cron.
Comment #13
mikeytown2 commentedCool, thanks for the info. Works how I hopped it would!
Comment #14
TheRec commentedSubscribing... (no I won't complain about
<noscript>, don't worry :P ... I know it is fixed, just archiving)