Skip to content

Commit

Permalink
added a conditional flag
Browse files Browse the repository at this point in the history
  • Loading branch information
icehaunter committed Jan 27, 2025
1 parent bc54892 commit aa4d0db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/sync-service/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,5 @@ config :electric,
shape_hibernate_after: shape_hibernate_after,
storage: storage,
persistent_kv: persistent_kv,
listen_on_ipv6?: env!("ELECTRIC_LISTEN_ON_IPV6", :boolean, nil)
listen_on_ipv6?: env!("ELECTRIC_LISTEN_ON_IPV6", :boolean, nil),
compaction?: env!("ELECTRIC_COMPACTION", :boolean, true)
11 changes: 9 additions & 2 deletions packages/sync-service/lib/electric/shapes/consumer_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,17 @@ defmodule Electric.Shapes.ConsumerSupervisor do
children = [
{Electric.ShapeCache.Storage, shape_storage},
{Electric.Shapes.Consumer, shape_config},
{Electric.Shapes.Consumer.Snapshotter, shape_config},
{Electric.ShapeCache.CompactionRunner, [{:storage, shape_storage} | metadata]}
{Electric.Shapes.Consumer.Snapshotter, shape_config}
]

children =
if Application.get_env(:electric, :compaction?, true) do
children ++
[{Electric.ShapeCache.CompactionRunner, [{:storage, shape_storage} | metadata]}]
else
children
end

Supervisor.init(children, strategy: :one_for_one, auto_shutdown: :any_significant)
end
end

0 comments on commit aa4d0db

Please sign in to comment.