[#3213] `timeout` option for `HashtagsTableMigrator.count/_`.
authorIvan Tashkinov <ivantashkinov@gmail.com>
Tue, 19 Jan 2021 18:17:06 +0000 (21:17 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Tue, 19 Jan 2021 18:17:06 +0000 (21:17 +0300)
lib/pleroma/migrators/hashtags_table_migrator.ex

index 048f3c8ee49548db2309fd0adedff62f07b5d194..6a6a7b5b8a11736e2640c5586f93bd842b371ccb 100644 (file)
@@ -192,13 +192,13 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do
     end)
   end
 
-  def count(force \\ false) do
+  def count(force \\ false, timeout \\ :infinity) do
     stored_count = state()[:count]
 
     if stored_count && !force do
       stored_count
     else
-      count = Repo.aggregate(query(), :count, :id)
+      count = Repo.aggregate(query(), :count, :id, timeout: timeout)
       put_stat(:count, count)
       count
     end