From 2e0ad42eca67bbd81358fbaccd5aaa3bca4145bd Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 6 Mar 2020 22:44:39 -0600 Subject: [PATCH] pagination: fix page count timeouts not being cached. Bug: if there was a timeout when calculating the page count, the timeout wouldn't be cached, so we would hit multiple timeouts trying to calculate the page count multiple times. --- app/logical/pagination_extension.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/logical/pagination_extension.rb b/app/logical/pagination_extension.rb index 27963ac5b..280e08398 100644 --- a/app/logical/pagination_extension.rb +++ b/app/logical/pagination_extension.rb @@ -107,7 +107,7 @@ module PaginationExtension @paginator_count ||= unscoped.from(except(:offset, :limit, :order).reorder(nil)).count rescue ActiveRecord::StatementInvalid => e if e.to_s =~ /statement timeout/ - 1_000_000 + @paginator_count ||= 1_000_000 else raise end