From d854d52ab9036e236ab1bab43986de570d0d8531 Mon Sep 17 00:00:00 2001 From: irl Date: Fri, 29 Nov 2024 18:43:56 +0000 Subject: [PATCH] feat(block): tweak blocky timing, mark job safe --- app/cli/automate.py | 1 + app/terraform/block/block_blocky.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/cli/automate.py b/app/cli/automate.py index 9a74c3f..ed6899b 100644 --- a/app/cli/automate.py +++ b/app/cli/automate.py @@ -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: diff --git a/app/terraform/block/block_blocky.py b/app/terraform/block/block_blocky.py index bf1e506..ce9499e 100644 --- a/app/terraform/block/block_blocky.py +++ b/app/terraform/block/block_blocky.py @@ -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