projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0effcd2
)
Add utility function to return infinite timeout for SQL transactions if we detect...
author
Mark Felder
<feld@feld.me>
Tue, 20 Apr 2021 16:10:39 +0000
(11:10 -0500)
committer
Mark Felder
<feld@feld.me>
Thu, 22 Apr 2021 15:15:50 +0000
(10:15 -0500)
lib/pleroma/utils.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/utils.ex
b/lib/pleroma/utils.ex
index bc0c953322338b347316b5414f4d3f36b78cfffb..5e2fa8bf7d27d1b88783e602e9057aba4ffeaedb 100644
(file)
--- a/
lib/pleroma/utils.ex
+++ b/
lib/pleroma/utils.ex
@@
-63,4
+63,13
@@
defmodule Pleroma.Utils do
end
def posix_error_message(_), do: ""
+
+ def query_timeout do
+ {parent, _, _, _} = Process.info(self(), :current_stacktrace) |> elem(1) |> Enum.fetch!(2)
+
+ cond do
+ parent |> to_string |> String.starts_with?("Elixir.Mix.Task") -> [timeout: :infinity]
+ true -> [timeout: 15_000]
+ end
+ end
end