Skip to content

Commit

Permalink
Stop segment queries when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
apata committed Feb 3, 2025
1 parent b4ec09c commit bf8f589
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/plausible/segments/segments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ defmodule Plausible.Segments do

@spec get_many(Plausible.Site.t(), list(pos_integer()), Keyword.t()) ::
{:ok, [Segment.t()]}
def get_many(%Plausible.Site{} = site, segment_ids, opts) when is_list(segment_ids) do
def get_many(%Plausible.Site{} = _site, segment_ids, _opts)
when segment_ids == [] do
{:ok, []}
end

def get_many(%Plausible.Site{} = site, segment_ids, opts)
when is_list(segment_ids) do
fields = Keyword.get(opts, :fields, [:id])

query =
Expand Down

0 comments on commit bf8f589

Please sign in to comment.