watchlist add: event only if inserted; adr 0015 jetstream/relay accuracy; drop vacuous assert

This commit is contained in:
2026-10-26 01:56:38 +01:00
parent d0568d7933
commit bde8040cc3
7 changed files with 58 additions and 14 deletions

View File

@@ -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)
}