From fbc187ac15524638db2b116ed2b7365aaecdf2e4 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 27 Mar 2018 16:09:08 +0200 Subject: [PATCH] Switch to Jason for json handling. It's twice as fast and will be the standard in the coming ecto. --- config/config.exs | 8 ++++++++ lib/pleroma/web/endpoint.ex | 2 +- mix.exs | 1 + mix.lock | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index bd714a189..a7429fcdf 100644 --- a/config/config.exs +++ b/config/config.exs @@ -9,6 +9,9 @@ use Mix.Config config :pleroma, ecto_repos: [Pleroma.Repo] +config :pleroma, Pleroma.Repo, + types: Pleroma.PostgresTypes + config :pleroma, Pleroma.Upload, uploads: "uploads" @@ -61,6 +64,11 @@ config :pleroma, :media_proxy, config :pleroma, :chat, enabled: true +config :ecto, json_library: Jason + +config :phoenix, :format_encoders, + json: Jason + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env}.exs" diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 93b37dc74..a2fb71451 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -29,7 +29,7 @@ defmodule Pleroma.Web.Endpoint do plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], - json_decoder: Poison + json_decoder: Jason plug Plug.MethodOverride plug Plug.Head diff --git a/mix.exs b/mix.exs index 00733c26a..7320ac543 100644 --- a/mix.exs +++ b/mix.exs @@ -41,6 +41,7 @@ defmodule Pleroma.Mixfile do {:calendar, "~> 0.16.1"}, {:cachex, "~> 2.1"}, {:httpoison, "~> 0.11.2"}, + {:jason, "~> 1.0"}, {:ex_machina, "~> 2.0", only: :test}, {:credo, "~> 0.7", only: [:dev, :test]}] end diff --git a/mix.lock b/mix.lock index d5aca57f7..80c7436fc 100644 --- a/mix.lock +++ b/mix.lock @@ -23,6 +23,7 @@ "html_sanitize_ex": {:hex, :html_sanitize_ex, "1.3.0", "f005ad692b717691203f940c686208aa3d8ffd9dd4bb3699240096a51fa9564e", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"}, "httpoison": {:hex, :httpoison, "0.11.2", "9e59f17a473ef6948f63c51db07320477bad8ba88cf1df60a3eee01150306665", [:mix], [{:hackney, "~> 1.8.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, "idna": {:hex, :idna, "5.0.2", "ac203208ada855d95dc591a764b6e87259cb0e2a364218f215ad662daa8cd6b4", [:rebar3], [{:unicode_util_compat, "0.2.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, + "jason": {:hex, :jason, "1.0.0", "0f7cfa9bdb23fed721ec05419bcee2b2c21a77e926bce0deda029b5adc716fe2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, "mime": {:hex, :mime, "1.2.0", "78adaa84832b3680de06f88f0997e3ead3b451a440d183d688085be2d709b534", [:mix], [], "hexpm"}, "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"}, -- 2.45.2