From 0578e47ffc96cc6c4a02f200404c7896e94becbe Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sun, 2 May 2021 16:07:43 -0700 Subject: [PATCH] mypy_primer: reduce polling frequency (#5322) This should cut down the API rate limiting we see when large numbers of PRs are submitted. Note when we used mypyc-compiled mypy in mypy_primer, this took <10m. This is currently not the case, but hopefully will once again be. Co-authored-by: hauntsaninja <> --- .github/workflows/mypy_primer_comment.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mypy_primer_comment.yml b/.github/workflows/mypy_primer_comment.yml index 4cc699f35..ef99b35ec 100644 --- a/.github/workflows/mypy_primer_comment.yml +++ b/.github/workflows/mypy_primer_comment.yml @@ -55,15 +55,19 @@ jobs: return undefined } - const end_time = Number(new Date()) + 60 * 60 * 1000 + // Timeout after half an hour + const end_time = Number(new Date()) + 30 * 60 * 1000 let primer_run = await check_mypy_primer() + // Sleep longer, initially + let sleep = 8 * 60 * 1000 while (!primer_run || primer_run.status != "completed" || primer_run.conclusion != "success") { if (Number(new Date()) > end_time) { throw Error("Timed out waiting for mypy_primer") } console.log("Waiting for mypy_primer to complete...") - await new Promise(r => setTimeout(r, 10000)) + await new Promise(r => setTimeout(r, sleep)) primer_run = await check_mypy_primer() + sleep = 60 * 1000 } console.log("Found mypy_primer run!") console.log(primer_run)