fix: refactorings to remove anti-patterns
This commit is contained in:
@@ -7,6 +7,15 @@ defmodule BDS.Embeddings.DismissedDuplicatePair do
|
||||
@primary_key {:id, :string, autogenerate: false}
|
||||
@foreign_key_type :string
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
id: String.t() | nil,
|
||||
project_id: String.t() | nil,
|
||||
project: term(),
|
||||
post_id_a: String.t() | nil,
|
||||
post_id_b: String.t() | nil,
|
||||
dismissed_at: integer() | nil
|
||||
}
|
||||
|
||||
schema "dismissed_duplicate_pairs" do
|
||||
belongs_to :project, BDS.Projects.Project, type: :string
|
||||
field :post_id_a, :string
|
||||
|
||||
@@ -23,6 +23,7 @@ defmodule BDS.Embeddings.Index do
|
||||
|
||||
alias BDS.Projects
|
||||
alias BDS.ProgressReporter
|
||||
require Logger
|
||||
|
||||
@neighbor_limit 21
|
||||
@debounce_ms 5_000
|
||||
@@ -345,7 +346,12 @@ defmodule BDS.Embeddings.Index do
|
||||
write_meta(index_path, dim, labels)
|
||||
:ok
|
||||
rescue
|
||||
_exception -> :ok
|
||||
exception ->
|
||||
Logger.debug(
|
||||
"swallowed embeddings index persist error for #{project_id}: #{inspect(exception)}"
|
||||
)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
defp write_meta(index_path, dim, labels) do
|
||||
@@ -385,7 +391,12 @@ defmodule BDS.Embeddings.Index do
|
||||
_other -> :error
|
||||
end
|
||||
rescue
|
||||
_exception -> :error
|
||||
exception ->
|
||||
Logger.debug(
|
||||
"swallowed embeddings index load_from_disk error for #{project_id}: #{inspect(exception)}"
|
||||
)
|
||||
|
||||
:error
|
||||
end
|
||||
|
||||
defp read_meta(index_path) do
|
||||
|
||||
Reference in New Issue
Block a user