diff --git a/Dockerfile b/Dockerfile index 6436bf0..f0e70f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,4 +49,4 @@ COPY ./rel ./rel RUN mix release --overwrite RUN mkdir indexes COPY ./litefs.yml ./litefs.yml -ENTRYPOINT litefs mount +CMD ["_build/prod/rel/ash_hq/bin/ash_hq", "start"] diff --git a/lib/ash_hq/application.ex b/lib/ash_hq/application.ex index 9222d55..6ec3c16 100644 --- a/lib/ash_hq/application.ex +++ b/lib/ash_hq/application.ex @@ -16,7 +16,7 @@ defmodule AshHq.Application do children = [ {FLAME.Pool, - name: AshHq.ImporterPool, min: 0, max: 1, max_concurrency: 1, idle_shutdown_after: 30_000}, + name: AshHq.ImporterPool, min: 0, max: 1, max_concurrency: 6, idle_shutdown_after: 30_000}, !flame_parent && Supervisor.child_spec({Finch, name: AshHq.Finch}, id: AshHq.Finch), !flame_parent && Supervisor.child_spec({Finch, name: Swoosh.Finch}, id: Swoosh.Finch), AshHq.Vault, diff --git a/lib/ash_hq/docs/importer/importer.ex b/lib/ash_hq/docs/importer/importer.ex index 792dce6..9c4b0d2 100644 --- a/lib/ash_hq/docs/importer/importer.ex +++ b/lib/ash_hq/docs/importer/importer.ex @@ -4,6 +4,6 @@ defmodule AshHq.Docs.Importer do """ def import() do - AshOban.Test.schedule_and_run_triggers(AshHq.Docs.Library) + AshOban.schedule_and_run_triggers(AshHq.Docs.Library) end end diff --git a/lib/ash_hq/docs/resources/library/library.ex b/lib/ash_hq/docs/resources/library/library.ex index 21fc7d3..ec1024b 100644 --- a/lib/ash_hq/docs/resources/library/library.ex +++ b/lib/ash_hq/docs/resources/library/library.ex @@ -4,13 +4,6 @@ defmodule AshHq.Docs.Library do data_layer: AshPostgres.DataLayer, extensions: [AshOban] - postgres do - table "libraries" - repo AshHq.Repo - - migration_defaults module_prefixes: "[]", skip_versions: "[]" - end - actions do defaults [:create, :update, :destroy] @@ -51,18 +44,17 @@ defmodule AshHq.Docs.Library do ] end - # litefs can't write from another node, so we had to turn this off - # change fn changeset, _ -> - # Ash.Changeset.around_transaction(changeset, fn changeset, func -> - # FLAME.call( - # AshHq.ImporterPool, - # fn -> - # func.(changeset) - # end, - # timeout: :timer.minutes(10) - # ) - # end) - # end + change fn changeset, _ -> + Ash.Changeset.around_transaction(changeset, fn changeset, func -> + FLAME.call( + AshHq.ImporterPool, + fn -> + func.(changeset) + end, + timeout: :timer.minutes(10) + ) + end) + end manual AshHq.Docs.Library.Actions.Import end @@ -131,6 +123,13 @@ defmodule AshHq.Docs.Library do end end + postgres do + table "libraries" + repo AshHq.Repo + + migration_defaults module_prefixes: "[]", skip_versions: "[]" + end + code_interface do define_for AshHq.Docs diff --git a/mix.lock b/mix.lock index 4e2465c..8cb1cac 100644 --- a/mix.lock +++ b/mix.lock @@ -13,7 +13,7 @@ "ash_csv": {:git, "https://github.com/ash-project/ash_csv.git", "7f47b820077619ccb7340fbede0c4fd1b5313a17", []}, "ash_graphql": {:git, "https://github.com/ash-project/ash_graphql.git", "cf57747d79f848608252ab167d74bb59aaef2345", []}, "ash_json_api": {:git, "https://github.com/ash-project/ash_json_api.git", "31ece4fad9920c7e45c600d38ac82218296c4612", []}, - "ash_oban": {:git, "https://github.com/ash-project/ash_oban.git", "36a441f78195f4f4e656f6a0cf268084704ff174", []}, + "ash_oban": {:git, "https://github.com/ash-project/ash_oban.git", "bfacb4572cda947bf6d5de27a075922b5d2e6c36", []}, "ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "35e4d2931e1664383c9a085a90f846e58986c8c8", []}, "ash_postgres": {:git, "https://github.com/ash-project/ash_postgres.git", "40c1a13652dc65406692ffbcaf6d78d1d8aa07c4", []}, "assent": {:hex, :assent, "0.2.7", "aa68f68e577077c091ce722bff8fe1ae56b95b274bb8107f7a5406cc15a65da7", [:mix], [{:certifi, ">= 0.0.0", [hex: :certifi, repo: "hexpm", optional: true]}, {:finch, "~> 0.15", [hex: :finch, repo: "hexpm", optional: true]}, {:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: true]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:ssl_verify_fun, ">= 0.0.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: true]}], "hexpm", "08106af439de4f9de114c0334de4c848de7cfbe53a5a52d342a784c4f6bc86f3"},