[dw-free] This adds the ability for workers to indicate that they want to get jobs in priority order
[commit: http://hg.dwscoalition.org/dw-free/rev/25a3848e4b8a]
This adds the ability for workers to indicate that they want to get jobs in
priority order. It also sets PubSubHubbub jobs to priority 200 so they jump
the queue for syndicated pulls.
Patch by
mark.
Files modified:
This adds the ability for workers to indicate that they want to get jobs in
priority order. It also sets PubSubHubbub jobs to priority 200 so they jump
the queue for syndicated pulls.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/worker/synsuck
- cgi-bin/LJ/SynSuck.pm
- cgi-bin/LJ/Worker/TheSchwartz.pm
-------------------------------------------------------------------------------- diff -r 8dc9568d4226 -r 25a3848e4b8a bin/worker/synsuck --- a/bin/worker/synsuck Wed Sep 02 18:14:38 2009 +0000 +++ b/bin/worker/synsuck Thu Sep 03 06:04:47 2009 +0000 @@ -20,6 +20,7 @@ use LJ::Worker::TheSchwartz; use LJ::Worker::TheSchwartz; use LJ::SynSuck; +schwartz_prioritize( 1 ); schwartz_decl( 'DW::Worker::SynSuck' ); schwartz_work(); diff -r 8dc9568d4226 -r 25a3848e4b8a cgi-bin/LJ/SynSuck.pm --- a/cgi-bin/LJ/SynSuck.pm Wed Sep 02 18:14:38 2009 +0000 +++ b/cgi-bin/LJ/SynSuck.pm Thu Sep 03 06:04:47 2009 +0000 @@ -532,6 +532,7 @@ sub process_hubbub_notification { funcname => 'DW::Worker::SynSuck', arg => { userid => $u->id }, uniqkey => "synsuck:" . $u->id, + priority => 200, # arbitrary, high ) ); # let devserver know diff -r 8dc9568d4226 -r 25a3848e4b8a cgi-bin/LJ/Worker/TheSchwartz.pm --- a/cgi-bin/LJ/Worker/TheSchwartz.pm Wed Sep 02 18:14:38 2009 +0000 +++ b/cgi-bin/LJ/Worker/TheSchwartz.pm Thu Sep 03 06:04:47 2009 +0000 @@ -18,9 +18,10 @@ my $quit_flag = 0; $quit_flag = 1; }; -@EXPORT = qw(schwartz_decl schwartz_work schwartz_on_idle schwartz_on_afterwork schwartz_on_prework); +@EXPORT = qw(schwartz_decl schwartz_work schwartz_on_idle schwartz_on_afterwork schwartz_on_prework schwartz_prioritize); my $sclient; +my $prioritize = 0; my $on_idle = sub {}; my $on_afterwork = sub {}; @@ -36,6 +37,7 @@ sub schwartz_init { $sclient = LJ::theschwartz({ role => $role }) or die "Could not get schwartz client"; $used_role = $role; # save success role $sclient->set_verbose($verbose); + $sclient->set_prioritize( $prioritize ); } sub schwartz_decl { @@ -47,6 +49,11 @@ sub schwartz_decl { schwartz_init($role) unless $sclient; $sclient->can_do($classname); +} + +sub schwartz_prioritize { + $prioritize = $_[0] ? 1 : 0; + $sclient->set_prioritize( $prioritize ) if $sclient; } sub schwartz_on_idle { --------------------------------------------------------------------------------