     )
 
     try do
-      {_count, _} = @repo.delete_all(query)
+      {_count, _} = ecto_repo().delete_all(query)
       {:ok, flag} = get(flag_name)
       {:ok, flag}
     rescue



  defp db_type do
    case @repo.__adapter__() do
      Ecto.Adapters.Postgres -> :postgres
      Ecto.Adapters.MySQL -> :mysql # legacy, Mariaex
      Ecto.Adapters.MyXQL -> :mysql # new in ecto_sql 3.1

        end
      else
        Logger.error("Couldn't acquire lock with 'SELECT GET_LOCK()' after #{@mysql_lock_timeout_s} seconds")
        ecto_repo().rollback("couldn't acquire lock")
      end
    end
  end
