logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20200905091427_rename_timeout_in_pools.exs (755B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.RenameTimeoutInPools do
  5. use Ecto.Migration
  6. def change do
  7. with %Pleroma.ConfigDB{} = config <-
  8. Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: :pools}) do
  9. updated_value =
  10. Enum.map(config.value, fn {pool, pool_value} ->
  11. with {timeout, value} when is_integer(timeout) <- Keyword.pop(pool_value, :timeout) do
  12. {pool, Keyword.put(value, :recv_timeout, timeout)}
  13. end
  14. end)
  15. config
  16. |> Ecto.Changeset.change(value: updated_value)
  17. |> Pleroma.Repo.update()
  18. end
  19. end
  20. end