LP#1744341 Hold targeter --retarget-frozen option user/berick/lp1744341-retarget-frozen-holds-2
authorBill Erickson <berickxx@gmail.com>
Fri, 19 Jan 2018 15:56:53 +0000 (10:56 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 5 Feb 2020 16:49:48 +0000 (11:49 -0500)
New --retarget-frozen option allows the targeter to include frozen holds
in batch retarget mode.  This lets admins periodically update hold copy
maps for frozen holds, which can accumulate links to deleted and
otherwise unholdable copies over time, skewing the hold queueu
positition calculation.

Commit includes release notes.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/HoldTargeter.pm
Open-ILS/src/perlmods/lib/OpenILS/Utils/HoldTargeter.pm
Open-ILS/src/support-scripts/hold_targeter.pl
docs/RELEASE_NOTES_NEXT/Administration/hold-retarget-frozen.adoc [new file with mode: 0644]

index afca2fc..da0c81b 100644 (file)
@@ -59,6 +59,10 @@ parallel_count => n
 parallel_slot => n [starts at 1]
   Sets the parallel targeter instance slot.  Used to determine
   which holds to process to avoid conflicts with other running instances.
+
+retarget_frozen => 1
+  Include frozen holds in batch hold retarget mode.  This allows the
+  targeter to refresh frozen hold copy maps which get stale over time.
 /
             }
         ],
index 44685cf..58ccc06 100644 (file)
@@ -47,6 +47,8 @@ sub find_holds_to_target {
         return ($self->{hold});
     }
 
+    my %frozen_filter = $self->{retarget_frozen} ? () : (frozen => 'f');
+
     my $query = {
         select => {ahr => ['id']},
         from => 'ahr',
@@ -54,7 +56,7 @@ sub find_holds_to_target {
             capture_time => undef,
             fulfillment_time => undef,
             cancel_time => undef,
-            frozen => 'f'
+            %frozen_filter
         },
         order_by => [
             {class => 'ahr', field => 'selection_depth', direction => 'DESC'},
index 93eaf4d..153e35d 100755 (executable)
@@ -20,6 +20,7 @@ my $lockfile = '/tmp/hold_targeter-LOCK';
 my $parallel = 0;
 my $verbose = 0;
 my $retarget_interval;
+my $retarget_frozen;
 my $soft_retarget_interval;
 my $next_check_interval;
 my $recv_timeout = 3600;
@@ -36,6 +37,7 @@ GetOptions(
     'verbose'               => \$verbose,
     'parallel-init-sleep=i' => \$parallel_init_sleep,
     'retarget-interval=s'   => \$retarget_interval,
+    'retarget-frozen'       => \$retarget_frozen,
     'next-check-interval=s'    => \$next_check_interval,
     'soft-retarget-interval=s' => \$soft_retarget_interval,
 ) || die "\nSee --help for more\n";
@@ -102,6 +104,10 @@ Targeting Options
         requested interval.
         Overrides the 'circ.holds.retarget_interval' global_flag value. 
 
+    --retarget-frozen
+        Include frozen holds in batch hold retarget mode.  This allows the
+        targeter to refresh frozen hold copy maps which get stale over time.
+
 HELP
 
     exit(0);
@@ -147,6 +153,7 @@ sub run_batches {
                 parallel_count  => $parallel,
                 parallel_slot   => $slot,
                 retarget_interval      => $retarget_interval,
+                retarget_frozen        => $retarget_frozen,
                 next_check_interval    => $next_check_interval,
                 soft_retarget_interval => $soft_retarget_interval
             }
diff --git a/docs/RELEASE_NOTES_NEXT/Administration/hold-retarget-frozen.adoc b/docs/RELEASE_NOTES_NEXT/Administration/hold-retarget-frozen.adoc
new file mode 100644 (file)
index 0000000..3f8b1fb
--- /dev/null
@@ -0,0 +1,13 @@
+Hold Targter --retarget-frozen option
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Adds a new --retarget-frozen option to hold_targeter_v2.pl that informs
+the hold targeter to include frozen holds in batch hold retarget
+mode.  This allows the targeter to refresh frozen hold copy maps which
+get stale over time, leading to potentially bogus queue position
+calculations.
+
+This functionality is included as an option and not baked into the
+targeter based on the assumption that admins may wish to only retarget
+frozen holds at certain times, since including frozen holds can extend
+the overall targeter run time.
+