Closed
Bug 621256
Opened 14 years ago
Closed 14 years ago
Allow jobqueue.pl to run once and then exit
Categories
(Bugzilla :: Administration, task)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.2
People
(Reporter: gerv, Assigned: gerv)
Details
Attachments
(1 file, 2 obsolete files)
1.97 KB,
patch
|
mkanat
:
review+
|
Details | Diff | Splinter Review |
Sometimes, for debugging or testing purposes, it's nice to run the jobqueue only once. TheSchwartz even has a method for this. So let's add a command-line parameter to jobqueue.pl which enables this behaviour. (I'm planning to use it in some tests for an extension, but I can see it being useful in general development and in core tests too.)
Gerv
Assignee | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Bit rot:
[dkl@localhost trunk]$ patch -p0 < ~/Downloads/621256.diff
patching file Bugzilla/JobQueue/Runner.pm
Hunk #2 FAILED at 196.
1 out of 2 hunks FAILED -- saving rejects to file Bugzilla/JobQueue/Runner.pm.rej
patching file jobqueue.pl
Assignee | ||
Comment 3•14 years ago
|
||
This patch was made against 3.6. But I just applied it to Bugzilla trunk as of now, and it worked fine (with a 5-line offset)...
gerv@kitten:/usr/src/bugzilla$ pmp
patch -p0 < /home/gerv/pm/621256.diff
patching file Bugzilla/JobQueue/Runner.pm
Hunk #2 succeeded at 201 (offset 5 lines).
patching file jobqueue.pl
gerv@kitten:/usr/src/bugzilla$
Gerv
Comment 4•14 years ago
|
||
Comment on attachment 499619 [details] [diff] [review]
Patch v.1
Ah, I think this should be a new command instead of a switch. (Because it only applies to the "start" command.)
Attachment #499619 -
Flags: review?(mkanat) → review-
Assignee | ||
Comment 5•14 years ago
|
||
OK, how about this :-)
(This interacts with the other one to add a hook to the job queue, but it's fairly obvious how to fix one if the other is checked in first.)
Gerv
Attachment #499619 -
Attachment is obsolete: true
Attachment #500802 -
Flags: review?(mkanat)
Comment 6•14 years ago
|
||
Comment on attachment 500802 [details] [diff] [review]
Patch v.2
>=== modified file 'Bugzilla/JobQueue/Runner.pm'
>+ my $jq = Bugzilla->job_queue();
>+ $jq->set_verbose($self->{debug});
>+ foreach my $module (values %{ Bugzilla::JobQueue::JOB_MAP() }) {
>+ eval "use $module";
>+ $jq->can_do($module);
>+ }
>+
>+ $jq->work_once;
Ah, this looks good, but could we abstract this out into an internal method, so that we don't have to have this code copied between gd_run and gd_other_cmd? It could just be a method that takes, as an argument, the method to call on $jq.
Attachment #500802 -
Flags: review?(mkanat) → review-
Assignee | ||
Comment 7•14 years ago
|
||
Review comments addressed.
Gerv
Attachment #500802 -
Attachment is obsolete: true
Attachment #506359 -
Flags: review?(mkanat)
Comment 8•14 years ago
|
||
Comment on attachment 506359 [details] [diff] [review]
Patch v.3
Beautiful!
Slight nit: The "else {" in gd_other_cmd() isn't needed, since the above block exits. You can just call $self->SUPER::gd_other_cmd() without a block.
Attachment #506359 -
Flags: review?(mkanat) → review+
Updated•14 years ago
|
Flags: approval+
Target Milestone: --- → Bugzilla 4.2
Assignee | ||
Comment 9•14 years ago
|
||
modified Bugzilla/JobQueue/Runner.pm
modified jobqueue.pl
Committed revision 7683.
Gerv
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•