video enrichment: fix DeArrow retry (was a silent no-op)
enrichment_retry handled ryd/sponsorblock + the keyed backfills, but DeArrow (also a youtube_video_stats backfill, keyed on dearrow_status) fell through to nothing — so the modal's Retry button did nothing for DeArrow. Fold dearrow into the youtube_video_stats retry branch. Regression test re-queues failed dearrow rows, leaves matched ones.
This commit is contained in:
parent
0eac0ea46e
commit
8349fa78dd
2 changed files with 21 additions and 3 deletions
|
|
@ -1096,9 +1096,9 @@ class VideoDatabase:
|
||||||
return cur.rowcount
|
return cur.rowcount
|
||||||
finally:
|
finally:
|
||||||
conn.close()
|
conn.close()
|
||||||
if service in ("ryd", "sponsorblock"):
|
if service in ("ryd", "sponsorblock", "dearrow"):
|
||||||
col = "ryd_status" if service == "ryd" else "sb_status"
|
col = {"ryd": "ryd_status", "sponsorblock": "sb_status", "dearrow": "dearrow_status"}[service]
|
||||||
att = "ryd_attempted" if service == "ryd" else "sb_attempted"
|
att = {"ryd": "ryd_attempted", "sponsorblock": "sb_attempted", "dearrow": "dearrow_attempted"}[service]
|
||||||
conn = self._get_connection()
|
conn = self._get_connection()
|
||||||
try:
|
try:
|
||||||
if scope == "item" and item_id is not None:
|
if scope == "item" and item_id is not None:
|
||||||
|
|
|
||||||
|
|
@ -81,3 +81,21 @@ def test_proxy_instances_setting_parsing(db):
|
||||||
assert ("invidious", "https://invidious.b.test") in got # kind inferred + trailing / stripped
|
assert ("invidious", "https://invidious.b.test") in got # kind inferred + trailing / stripped
|
||||||
assert ("piped", "https://c.test") in got
|
assert ("piped", "https://c.test") in got
|
||||||
assert all(u.startswith("http") for _, u in got) # 'junk' dropped
|
assert all(u.startswith("http") for _, u in got) # 'junk' dropped
|
||||||
|
|
||||||
|
|
||||||
|
def test_dearrow_retry_requeues_failed_youtube_videos(db):
|
||||||
|
# Regression: enrichment_retry only handled ryd/sponsorblock, so DeArrow's
|
||||||
|
# Retry button was a silent no-op. It must re-queue failed dearrow rows.
|
||||||
|
conn = db._get_connection()
|
||||||
|
conn.execute("INSERT INTO youtube_video_stats (youtube_id, dearrow_status) VALUES ('a', 'not_found')")
|
||||||
|
conn.execute("INSERT INTO youtube_video_stats (youtube_id, dearrow_status) VALUES ('b', 'error')")
|
||||||
|
conn.execute("INSERT INTO youtube_video_stats (youtube_id, dearrow_status) VALUES ('c', 'ok')")
|
||||||
|
conn.commit(); conn.close()
|
||||||
|
|
||||||
|
n = db.enrichment_retry("dearrow", "video", scope="failed")
|
||||||
|
assert n == 2 # the not_found + error rows
|
||||||
|
conn = db._get_connection()
|
||||||
|
rows = dict(conn.execute("SELECT youtube_id, dearrow_status FROM youtube_video_stats").fetchall())
|
||||||
|
conn.close()
|
||||||
|
assert rows["a"] is None and rows["b"] is None # re-queued
|
||||||
|
assert rows["c"] == "ok" # matched left untouched
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue