watchlist add: event only if inserted; adr 0015 jetstream/relay accuracy; drop vacuous assert
This commit is contained in:
@@ -39,7 +39,7 @@ impl WatchlistRepository for SqliteWatchlistRepository {
|
||||
.begin()
|
||||
.await
|
||||
.map_err(crate::shared::map_sqlx_error)?;
|
||||
sqlx::query(
|
||||
let inserted = sqlx::query(
|
||||
"INSERT OR IGNORE INTO watchlist_entries (id, user_id, movie_id, added_at) \
|
||||
VALUES (?, ?, ?, ?)",
|
||||
)
|
||||
@@ -49,8 +49,13 @@ impl WatchlistRepository for SqliteWatchlistRepository {
|
||||
.bind(&added_at)
|
||||
.execute(&mut *tx)
|
||||
.await
|
||||
.map_err(crate::shared::map_sqlx_error)?;
|
||||
enqueue_events(&mut tx, events).await?;
|
||||
.map_err(crate::shared::map_sqlx_error)?
|
||||
.rows_affected()
|
||||
> 0;
|
||||
// A repeat add changed nothing, so it announces nothing.
|
||||
if inserted {
|
||||
enqueue_events(&mut tx, events).await?;
|
||||
}
|
||||
tx.commit().await.map_err(crate::shared::map_sqlx_error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user