Added transaction protection

This commit is contained in:
florian committed 2026-11-01 17:41:56 +01:00
1 parent bbb4ac5f11
commit df3f9e147c
1 file changed
+2 -2
+2 -2
View File
@@ -359,7 +359,7 @@ def delete_feed(
try: try:
with db.cursor() as cursor: with db.cursor() as cursor:
cursor.execute( cursor.execute(
"SELECT id FROM rss_feeds WHERE rss_feed = %s", "SELECT id FROM rss_feeds WHERE rss_feed = %s FOR UPDATE",
(url,), (url,),
) )
known = cursor.fetchone() known = cursor.fetchone()
@@ -377,7 +377,7 @@ def delete_feed(
cursor.execute( cursor.execute(
"SELECT 1 from rss_feed_subscriptions " "SELECT 1 from rss_feed_subscriptions "
"WHERE rss_feed_id = %s AND active = 1 LIMIT 1", "WHERE rss_feed_id = %s AND active = 1 LIMIT 1 FOR SHARE",
(feed_id,), (feed_id,),
) )
if cursor.fetchone() is None: if cursor.fetchone() is None: