fix: queue on publish failure, not just rate limit
This commit is contained in:
+10
-13
@@ -204,17 +204,17 @@ async def reupload_asset(asset_id: int, _: str = Depends(verify_api_key)):
|
|||||||
)
|
)
|
||||||
|
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
collectible_item_id = await roblox_onsale.publish_collectible(
|
asset_type_name = (
|
||||||
new_asset_id, int(TARGET), asset.name, new_description
|
"Shirt" if asset.asset_type == RbxAssetType.SHIRT else "Pants"
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await roblox_onsale.onsale_asset(collectible_item_id)
|
collectible_item_id = await roblox_onsale.publish_collectible(
|
||||||
except RateLimitError:
|
new_asset_id, int(TARGET), asset.name, new_description
|
||||||
print(
|
|
||||||
f"Rate limit hit for asset {new_asset_id}, adding to retry queue."
|
|
||||||
)
|
)
|
||||||
asset_type_name = (
|
await roblox_onsale.onsale_asset(collectible_item_id)
|
||||||
"Shirt" if asset.asset_type == RbxAssetType.SHIRT else "Pants"
|
except (RateLimitError, Exception) as e:
|
||||||
|
print(
|
||||||
|
f"Publish/onsale failed for asset {new_asset_id}, adding to retry queue: {e}"
|
||||||
)
|
)
|
||||||
database.add_to_onsale_queue(
|
database.add_to_onsale_queue(
|
||||||
new_asset_id,
|
new_asset_id,
|
||||||
@@ -223,18 +223,15 @@ async def reupload_asset(asset_id: int, _: str = Depends(verify_api_key)):
|
|||||||
new_description,
|
new_description,
|
||||||
int(TARGET),
|
int(TARGET),
|
||||||
asset_type_name,
|
asset_type_name,
|
||||||
collectible_item_id,
|
None,
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
"uploaded": uploaded,
|
"uploaded": uploaded,
|
||||||
"onsale": "queued",
|
"onsale": "queued",
|
||||||
"info": "Rate limit hit, item will be put on sale automatically later.",
|
"info": f"Publish/onsale failed, will retry automatically: {e}",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send Discord notification (only for successful initial onsale)
|
# Send Discord notification (only for successful initial onsale)
|
||||||
asset_type_name = (
|
|
||||||
"Shirt" if asset.asset_type == RbxAssetType.SHIRT else "Pants"
|
|
||||||
)
|
|
||||||
await discord.send_upload_webhook(
|
await discord.send_upload_webhook(
|
||||||
asset.name, asset_id, new_asset_id, asset_type_name
|
asset.name, asset_id, new_asset_id, asset_type_name
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user