[#3213] `timeout` option for `HashtagsTableMigrator.count/_`.

This commit is contained in:
Ivan Tashkinov 2021-01-19 21:17:06 +03:00
parent 7f07909a7b
commit f0f0f2af00
1 changed files with 2 additions and 2 deletions

View File

@ -192,13 +192,13 @@ defp transfer_object_hashtags(object) do
end) end)
end end
def count(force \\ false) do def count(force \\ false, timeout \\ :infinity) do
stored_count = state()[:count] stored_count = state()[:count]
if stored_count && !force do if stored_count && !force do
stored_count stored_count
else else
count = Repo.aggregate(query(), :count, :id) count = Repo.aggregate(query(), :count, :id, timeout: timeout)
put_stat(:count, count) put_stat(:count, count)
count count
end end