| Project: | Multiping |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I have a suggestion that would improve Multiping, when it is being used in conjunction with the Scheduler module. Currently the weight of both modules is not changed from the default zero, so during a cron run, Multiping is executed before Scheduler (I believe this is because M comes before S in the alphabet). This means that if Scheduler publishes content then the pings are not sent until the next cron run. If the weight of the Multiping module was set to be heavier than that of Scheduler then it would execute after Scheduler and the pings would therefore be sent during the same cron run as when the content is published.
I think that all you need to do is add the following code to multiping's hook_install()
<?php
$weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'"));
db_query("UPDATE {system} SET weight = %d WHERE name = 'multiping'", $weight + 10);
?>If scheduler is not installed then the above will just set the Multiping weight to 10, which is fine.
What do you think?
Jonathan
Comments
#1
I've made a patch for the change.
And while I was at it, I added the standard comment headers and $Id$ required by cvs.
Jonathan
#2
Here is a re-roll, following the code tidy-up (Thanks Voxpelli, great work)
Does anyone else use Multiping and Scheduler together? If so, please test this. After applying the patch, you need to disable Multiping then re-enable, to execute the code in hook_enable() inside multiping.install. Don't worry, your services will not be deleted!
Jonathan
#3
Wow! what a coincidence that is! I just happen to post this patch again, completely by chance, exactly one year to the day after my previous post. Completely unplanned!
#4
Sorry for the extremely long time it took for me to look at this. Seems like Multiping always should run a bit later than everyone else due to it reacting on things being edited - so a more generic solution would be to set Multipings weight to 10 no matter if any other module exist.
How does that sound?
#5
Yes, the idea sounds fine. A quick look in my system table shows that Views, Comment_notify and Pingback all have weight 10. The only other weight greater than 10 is Devel on 99. Are there accepted ranges for weights of modules which do similar things? It looks like Multiping should at least have something more than 10.
#6
I set it to 20 now - committed and will appear in the dev-build soon :)
#7
Automatically closed -- issue fixed for 2 weeks with no activity.