Make sure the "running" indicator goes away
authorMike Rylander <mrylander@gmail.com>
Tue, 30 Apr 2013 15:26:00 +0000 (11:26 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 2 May 2013 14:09:06 +0000 (10:09 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index 5ea3602..1b6a9ce 100644 (file)
@@ -1307,7 +1307,7 @@ sub staged_search {
             $cache_data = $cache->get_cache($key) || {};
             last if (!$cache_data->{running});
         }
-    } else { # we're the first ... let's give it a try
+    } elsif (!$cache_data->{0}) { # we're the first ... let's give it a try
         $cache->put_cache($key, { running => $$ }, $cache_timeout / 3);
     }
 
@@ -1409,6 +1409,13 @@ sub staged_search {
         }
     }
 
+    # Let other backends grab our data now that we're done.
+    $cache_data = $cache->get_cache($key);
+    if ($$cache_data{running} and $$cache_data{running} == $$) {
+        delete $$cache_data{running};
+        $cache->put_cache($key, $cache_data, $cache_timeout);
+    }
+
     my @results = grep {defined $_} @$all_results[$user_offset..($user_offset + $user_limit - 1)];
 
        # refine the estimate if we have more than one superpage