Add back lock now that db supports it

This commit is contained in:
Chris McCord 2024-06-05 23:07:22 -04:00
parent a68a9a8d51
commit ac9780472e

View file

@ -410,7 +410,7 @@ defmodule LiveBeats.MediaLibrary do
multi = multi =
Ecto.Multi.new() Ecto.Multi.new()
# |> lock_playlist(song.user_id) |> lock_playlist(song.user_id)
|> Ecto.Multi.run(:index, fn repo, _changes -> |> Ecto.Multi.run(:index, fn repo, _changes ->
case repo.one(from(s in Song, where: s.user_id == ^song.user_id, select: count(s.id))) do case repo.one(from(s in Song, where: s.user_id == ^song.user_id, select: count(s.id))) do
count when new_index < count -> {:ok, new_index} count when new_index < count -> {:ok, new_index}