(Correctly) Use idlist function to reduce network overhead
authorMike Rylander <mrylander@gmail.com>
Mon, 1 Jun 2020 21:42:06 +0000 (17:42 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 1 Jun 2020 21:42:06 +0000 (17:42 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm

index de1f688..baf8ce1 100644 (file)
@@ -158,10 +158,10 @@ sub fetch_latest_delivered { # returns appointments delivered TODAY
         arrival => { '!=' => undef},
         delivered => { '>' => 'today'},
     },{
-        idlist => 1, order_by => { acsp => {delivered => {direction => 'desc'}} }
-    }]);
+        order_by => { acsp => {delivered => {direction => 'desc'}} }
+    }],{ idlist => 1 });
 
-    return md5_hex( join(',', map { $_->id . $_->slot // '' } @$slots) );
+    return md5_hex( join(',', @$slots) );
 }
 __PACKAGE__->register_method(
     method   => "fetch_latest_delivered",
@@ -245,10 +245,10 @@ sub fetch_latest_arrived {
         arrival => { '!=' => undef},
         delivered => undef,
     },{
-        idlist => 1, order_by => { acsp => { arrival => { direction => 'desc' } } }
-    }]);
+        order_by => { acsp => { arrival => { direction => 'desc' } } }
+    }],{ idlist => 1 });
 
-    return md5_hex( join(',', map { $_->id . $_->slot // '' } @$slots) );
+    return md5_hex( join(',', @$slots) );
 }
 __PACKAGE__->register_method(
     method   => "fetch_latest_arrived",
@@ -332,14 +332,13 @@ sub fetch_latest_staged {
         staged => { '!=' => undef},
         arrival => undef
     },{
-        idlist => 1, # fully ordered IDs will capture insertion, deletion, AND edit
         order_by => [
             { class => acsp => field => slot => direction => 'desc' },
             { class => acsp => field => id   => direction => 'desc' }
         ]
-    }]);
+    }],{ idlist => 1 });
 
-    return md5_hex( join(',', map { $_->id . $_->slot // '' } @$slots) );
+    return md5_hex( join(',', @$slots) );
 }
 __PACKAGE__->register_method(
     method   => "fetch_latest_staged",
@@ -443,14 +442,13 @@ sub fetch_latest_to_be_staged {
         staged => undef,
         slot => { '<=' => $horizon->strftime('%FT%T%z') },
     },{
-        idlist => 1, # fully ordered IDs will capture insertion, deletion, AND edit
         order_by => [
             { class => acsp => field => slot => direction => 'desc' },
             { class => acsp => field => id   => direction => 'desc' }
         ]
-    }]);
+    }],{ idlist => 1 });
 
-    return md5_hex( join(',', map { $_->id . $_->slot // '' } @$slots) );
+    return md5_hex( join(',', @$slots) );
 }
 __PACKAGE__->register_method(
     method   => "fetch_latest_to_be_staged",