|
From: Lionel B. <lio...@bo...> - 2007-01-29 18:40:39
|
Hi, I'm back from my winter holidays. I initially liked your patch to updateconfig because it seemed cleaner than what we discussed (at least less complex) but then I realized there are 2 bugs. update_config doesn't try to check for an $old_value if it is 0 which makes it impossible to check for a successful update from a value expected to be 0. This is a corner case, but you can avoid it by using (defined $old_value) ? ... instead of ($old_value) ? ... This is only a design problem with no actual consequence now but it's safer to avoid any complication... Anyway the second bug is quite serious and you'll have to remove the patch to update_config unless you find another need for it... Given that you only check for equality and not the timestamp being expired at most only one SQLgrey instance will ever update the value and then clean up (looking at the details, this will be the last instance being launched). If this instance is shut down no other instance will try to cleanup. You could even end with no cleanup occuring if the two successive calls to time() give back two different values (your local copy won't match the database), this could be fixed, but you can't avoid the "cleanup" instance shuting down stops cleanup if you check for equality. Conclusion : you can't use the config table, given that it only stores varchars (you can't compare timestamps stored as varchars). You need to create another table with only one stored value in a timestamp column and check for expiration not equality. Lionel. |