feat(block): tweak blocky timing, mark job safe

This commit is contained in:
Iain Learmonth 2024-11-29 18:43:56 +00:00
parent 8449a5a8c8
commit d854d52ab9
2 changed files with 5 additions and 3 deletions

View file

@ -159,6 +159,7 @@ def run_job(job_cls: Type[BaseAutomation], *,
"list_s3",
"list_github",
"list_gitlab",
"block_blocky",
"block_external"
]
if job.short_name not in safe_jobs:

View file

@ -30,7 +30,7 @@ def request_test_now(test_url: str) -> str:
"Cache-Control": "no-cache"
}
request_count = 0
while request_count < 60:
while request_count < 180:
params = {
"url": test_url,
"timestamp": str(int(time.time())) # unix timestamp
@ -43,7 +43,7 @@ def request_test_now(test_url: str) -> str:
logging.debug("Test result for %s has test result ID %s", test_url, url_test_id)
return url_test_id
request_count += 1
time.sleep(1)
time.sleep(2)
raise RuntimeWarning("Exceeded timeout requesting result")
@ -65,7 +65,7 @@ def request_test_result(url_test_id: str) -> int:
class BlockBlockyAutomation(BlockMirrorAutomation):
short_name = "block_blocky"
description = "Use the Blocky API to test for blocked mirrors in China"
interval = 300
frequency = 300
def fetch(self) -> None:
pass
@ -78,6 +78,7 @@ class BlockBlockyAutomation(BlockMirrorAutomation):
.join(Country, Country.id == country_origin.c.country_id)
.filter(
Country.country_code == "CN",
Proxy.url.is_not(None),
Proxy.deprecated.is_(None),
Proxy.destroyed.is_(None),
Proxy.pool_id != -1