feat: recover failed scheduled uploads with bounded persistent retries [skip ci]
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import base64
|
||||
import ipaddress
|
||||
import json
|
||||
import socket
|
||||
from io import BytesIO
|
||||
from urllib.parse import urlsplit
|
||||
@@ -115,9 +116,17 @@ class Assets:
|
||||
def promote(self, asset_id):
|
||||
row = self.db.one("SELECT * FROM assets WHERE id=?", (asset_id,))
|
||||
if row and row["kind"] == "cache":
|
||||
target = self.settings.data_dir / "images" / (asset_id + ".jpg")
|
||||
source = self.db.one(
|
||||
"SELECT payload FROM asset_sources WHERE asset_id=?", (asset_id,)
|
||||
)
|
||||
kind = (
|
||||
"generated"
|
||||
if source and json.loads(source["payload"]).get("type") == "template"
|
||||
else "images"
|
||||
)
|
||||
target = self.settings.data_dir / kind / (asset_id + ".jpg")
|
||||
self.path(asset_id).replace(target)
|
||||
self.db.execute("UPDATE assets SET kind='images' WHERE id=?", (asset_id,))
|
||||
self.db.execute("UPDATE assets SET kind=? WHERE id=?", (kind, asset_id))
|
||||
return self.info(asset_id)
|
||||
|
||||
def info(self, asset_id):
|
||||
|
||||
Reference in New Issue
Block a user