Retries
This commit is contained in:
parent
54876a052d
commit
f3dc9bb001
3 changed files with 78 additions and 59 deletions
|
|
@ -17,12 +17,12 @@ export default async (req: Request, res: Response) => {
|
|||
|
||||
// Determine how many items in the queue are ahead of this one
|
||||
const aheadInQueue = await Jobs.find({
|
||||
queue_place: { $lt: job.queuePlace },
|
||||
queue_place: { $lte: job.queuePlace },
|
||||
});
|
||||
|
||||
let text: string = "";
|
||||
if (job.status == Status.ENQUEUED) {
|
||||
text = `Enqueued: ${aheadInQueue.length} Job(s) ahead in queue`;
|
||||
text = `Enqueued: ${aheadInQueue.length + 1} Job(s) ahead in queue`;
|
||||
} else if (job.status == Status.PROCESSING) {
|
||||
text = `Currently Processing\n${job.logs}`;
|
||||
} else if (job.status == Status.COMPLETE) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ from os import environ as env
|
|||
from os import unlink as rm
|
||||
from textwrap import dedent
|
||||
from typing import List
|
||||
from urllib3.exceptions import ProtocolError
|
||||
|
||||
import requests
|
||||
from urllib3.exceptions import ProtocolError, ReadTimeoutError
|
||||
|
||||
import curse_api as cf
|
||||
from common import Job, Status
|
||||
|
|
@ -90,6 +91,8 @@ class FastProvider(MgmtApiLogger):
|
|||
}
|
||||
)
|
||||
|
||||
tries, msg = 1, ""
|
||||
while tries <= 5:
|
||||
try:
|
||||
response = requests.post(
|
||||
"https://api.modrinth.com/v2/version",
|
||||
|
|
@ -115,12 +118,17 @@ class FastProvider(MgmtApiLogger):
|
|||
)
|
||||
|
||||
rm(jar_fn)
|
||||
except (ProtocolError, requests.exceptions.ChunkedEncodingError):
|
||||
self.logmsg(f"🔥 Uploading {display_nm} to Modrinth failed, skipping..")
|
||||
statuses.append(Status.FAIL)
|
||||
break
|
||||
except (ReadTimeoutError, TimeoutError):
|
||||
tries += 1
|
||||
msg = f"🕜 Timed out uploading {jar_fn}. Manual upload required"
|
||||
continue
|
||||
except TimeoutError:
|
||||
self.logmsg(f"🕜 Timed out uploading {jar_fn}. Manual upload required")
|
||||
except (ProtocolError, requests.exceptions.ChunkedEncodingError):
|
||||
tries += 1
|
||||
msg = f"🔥 Uploading {display_nm} to Modrinth failed, skipping.."
|
||||
continue
|
||||
if tries == 5:
|
||||
self.logmsg(msg)
|
||||
statuses.append(Status.FAIL)
|
||||
# endregion UPLOAD JAR FILE
|
||||
return statuses
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from selenium.webdriver.chrome.service import Service
|
|||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from urllib3.exceptions import ProtocolError, ReadTimeoutError
|
||||
from webdriver_manager.chrome import ChromeDriverManager
|
||||
|
||||
import curse_api as cf
|
||||
|
|
@ -212,6 +213,8 @@ class SlowProvider(MgmtApiLogger):
|
|||
}
|
||||
)
|
||||
|
||||
tries, msg = 1, ""
|
||||
while tries <= 5:
|
||||
try:
|
||||
response = requests.post(
|
||||
"https://api.modrinth.com/v2/version",
|
||||
|
|
@ -237,10 +240,18 @@ class SlowProvider(MgmtApiLogger):
|
|||
)
|
||||
|
||||
rm(f"./out/{self._job.curseforge_slug}/{fpath}")
|
||||
except TimeoutError:
|
||||
self.logmsg(f"🕜 Timed out uploading {fpath}. Manual upload required")
|
||||
break
|
||||
except (ReadTimeoutError, TimeoutError):
|
||||
tries += 1
|
||||
msg = f"🕜 Timed out uploading {fpath}. Manual upload required"
|
||||
continue
|
||||
except (ProtocolError, requests.exceptions.ChunkedEncodingError):
|
||||
tries += 1
|
||||
msg = f"🔥 Uploading {display_nm} to Modrinth failed, skipping.."
|
||||
continue
|
||||
if tries == 5:
|
||||
self.logmsg(msg)
|
||||
statuses.append(Status.FAIL)
|
||||
|
||||
# endregion UPLOAD THE MOD
|
||||
|
||||
any_succ = len(list(filter(lambda x: x == Status.SUCCESS, statuses))) > 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue