Closed (fixed)
Project:
Usernode
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2007 at 04:09 UTC
Updated:
8 Apr 2007 at 15:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
fagohm, doing it that way would be really inefficient. Consider sites that use cron really often, it will have to do a lot of user checking... I think we need a way to determine in the cron hook in a efficient way if there is work to do, perhaps through setting a $conf variable.
Comment #2
douggreen commentedOnce the users are updated, it doesn't do any additional work. So, the only real work in cron is a single SELECT statement. If this really bothers you, we can add a variable_get/variable_set.
Personally, I don't like this solution because it essentially stores the same information in two places, leaving the possibility that the cached version will be out of date with the real version. As there's not much of a performance gain (saving a single SELECT on every cron), I opt for simplicity and maintainability.
Comment #3
fagono, it will do two not really simple queries. And that every time although there is no need to it, so yes I worry about it. I like the idea, however it needs to be done in a efficient way.
So a simple variable_set/get would just solve it. The variable could be set on hook_enable and deleted after the work has been completed.
Comment #4
douggreen commentedPatch attached as requested...
Comment #5
fagothanks for your work!
Please return TRUE and FALSE instead of 0,1.. Also use boolean values as default values for the variable_get() not 0.
Furthermore I've overlooked a small thing that was already in your last patch: To use the db-abstraction layer correctly use http://api.drupal.org/api/5/function/db_query_range instead of manually adding LIMIT to the query.
Otherwise patch looks fine and will be a great addition to usernode!
Comment #6
douggreen commentedNew patch attached. Good catch on the db_query_range(), I obviously forgot about that. I also changed the return 0/1 to FALSE/TRUE because you asked.
But I do believe that this is bad practice by the Drupal community, and I'm trying to get some steam around the discussion. You can follow the thread here,
Comment #7
fagothanks! I've further replaced two other 0/1 with FALSE/TRUE and added a comment.
Committed to 5.x and HEAD.
Comment #8
(not verified) commented