瀏覽代碼

Add utility function to return infinite timeout for SQL transactions if we detect it was called from a Mix Task

test/buildperf
Mark Felder 3 年之前
父節點
當前提交
9bc69196d5
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      lib/pleroma/utils.ex

+ 9
- 0
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

Loading…
取消
儲存