mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-17 03:43:39 +12:00
improvement: disable FLAME for now
This commit is contained in:
parent
5c40226d2e
commit
33b8317367
6 changed files with 49 additions and 40 deletions
|
@ -44,7 +44,7 @@ config :ash_hq, Oban,
|
|||
Oban.Plugins.Pruner,
|
||||
{Oban.Plugins.Cron, crontab: []}
|
||||
],
|
||||
queues: [importer: [limit: 3, paused: not (periodic_imports? || config_env() == :prod)]]
|
||||
queues: [importer: [limit: 1, paused: not (periodic_imports? || config_env() == :prod)]]
|
||||
|
||||
if config_env() == :prod do
|
||||
app_name =
|
||||
|
@ -85,7 +85,7 @@ if config_env() == :prod do
|
|||
|
||||
config :flame, :backend, FLAME.FlyBackend
|
||||
config :flame, FLAME.FlyBackend, token: System.fetch_env!("FLY_API_TOKEN")
|
||||
config :flame, :terminator, shutdown_timeout: :timer.minutes(10)
|
||||
config :flame, :terminator, shutdown_timeout: :timer.seconds(30)
|
||||
|
||||
# The secret key base is used to sign/encrypt cookies and other secrets.
|
||||
# A default value is used in config/dev.exs and config/test.exs but you
|
||||
|
|
|
@ -11,16 +11,12 @@ defmodule AshHq.Application do
|
|||
|
||||
Appsignal.Phoenix.LiveView.attach()
|
||||
|
||||
topologies = Application.get_env(:libcluster, :topologies) || []
|
||||
# topologies = Application.get_env(:libcluster, :topologies) || []
|
||||
|
||||
children =
|
||||
[
|
||||
{FLAME.Pool,
|
||||
name: AshHq.ImporterPool,
|
||||
min: 0,
|
||||
max: 1,
|
||||
max_concurrency: 10,
|
||||
idle_shutdown_after: 30_000},
|
||||
name: AshHq.ImporterPool, min: 0, max: 1, max_concurrency: 1, 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,
|
||||
|
@ -32,10 +28,11 @@ defmodule AshHq.Application do
|
|||
# Start the PubSub system
|
||||
{Phoenix.PubSub, name: AshHq.PubSub},
|
||||
# Start the Endpoint (http/https)
|
||||
!flame_parent && AshHqWeb.Endpoint,
|
||||
AshHqWeb.Endpoint,
|
||||
{AshHq.Docs.Library.Agent, nil},
|
||||
# !flame_parent && {Cluster.Supervisor, [topologies, [name: AshHq.ClusterSupervisor]]},
|
||||
{Haystack.Storage.ETS, storage: AshHq.Docs.Indexer.storage()},
|
||||
!flame_parent && {Cluster.Supervisor, [topologies, [name: AshHq.ClusterSupervisor]]},
|
||||
!flame_parent && AshHq.Docs.Indexer,
|
||||
!flame_parent && AshHq.Github.Monitor,
|
||||
!flame_parent && oban_worker(),
|
||||
|
|
|
@ -71,26 +71,36 @@ defmodule AshHq.Docs.Library.Actions.Import do
|
|||
if result do
|
||||
Logger.info("Starting import of #{name}: #{version}")
|
||||
|
||||
delete_except(
|
||||
AshHq.Docs.load!(library, :latest_version_id).latest_version_id,
|
||||
library.id
|
||||
)
|
||||
unless AshHq.Docs.exists?(
|
||||
Ash.Query.for_read(AshHq.Docs.LibraryVersion, :read)
|
||||
|> Ash.Query.filter(library_id == ^library.id and version == ^version)
|
||||
) do
|
||||
AshHq.SqliteRepo.transaction(
|
||||
fn ->
|
||||
delete_except(
|
||||
AshHq.Docs.load!(library, :latest_version_id).latest_version_id,
|
||||
library.id
|
||||
)
|
||||
|
||||
library_version =
|
||||
AshHq.Docs.LibraryVersion.build!(
|
||||
library.id,
|
||||
version,
|
||||
%{
|
||||
timeout: :infinity,
|
||||
extensions: result[:extensions],
|
||||
doc: result[:doc],
|
||||
guides: result[:guides],
|
||||
modules: result[:modules],
|
||||
mix_tasks: result[:mix_tasks]
|
||||
}
|
||||
library_version =
|
||||
AshHq.Docs.LibraryVersion.build!(
|
||||
library.id,
|
||||
version,
|
||||
%{
|
||||
timeout: :infinity,
|
||||
extensions: result[:extensions],
|
||||
doc: result[:doc],
|
||||
guides: result[:guides],
|
||||
modules: result[:modules],
|
||||
mix_tasks: result[:mix_tasks]
|
||||
}
|
||||
)
|
||||
|
||||
delete_except(library_version.id, library.id)
|
||||
end,
|
||||
timeout: :infinity
|
||||
)
|
||||
|
||||
delete_except(library_version.id, library.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -51,17 +51,18 @@ defmodule AshHq.Docs.Library do
|
|||
]
|
||||
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
|
||||
# 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
|
||||
|
||||
manual AshHq.Docs.Library.Actions.Import
|
||||
end
|
||||
|
|
|
@ -711,7 +711,7 @@ defmodule Utils do
|
|||
|> Map.new()
|
||||
|> Map.put(:order, index)
|
||||
|> Map.put(:route, route)
|
||||
|> Map.put(:category, category)
|
||||
|> Map.put(:category, List.first(List.wrap(category)))
|
||||
|> Map.put(:text, File.read!(path))
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -4,4 +4,5 @@ export ERL_AFLAGS="-proto_dist inet6_tcp"
|
|||
export ECTO_IPV6="true"
|
||||
export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal"
|
||||
export RELEASE_DISTRIBUTION="name"
|
||||
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
|
||||
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
|
||||
export RELEASE_COOKIE="ash-hq-app"
|
Loading…
Reference in a new issue