logo

pleroma

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

maintenance.ex (838B)


  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.Maintenance do
  5. alias Pleroma.Repo
  6. require Logger
  7. def vacuum(args) do
  8. case args do
  9. "analyze" ->
  10. Logger.info("Running VACUUM ANALYZE.")
  11. Repo.query!(
  12. "vacuum analyze;",
  13. [],
  14. timeout: :infinity
  15. )
  16. "full" ->
  17. Logger.info("Running VACUUM FULL.")
  18. Logger.warning(
  19. "Re-packing your entire database may take a while and will consume extra disk space during the process."
  20. )
  21. Repo.query!(
  22. "vacuum full;",
  23. [],
  24. timeout: :infinity
  25. )
  26. _ ->
  27. Logger.error("Error: invalid vacuum argument.")
  28. end
  29. end
  30. end