Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge #1084
Browse files Browse the repository at this point in the history
1084: Send a message on GitHub when a duplicate preflight poll terminates. r=notriddle a=zli-simspace

Gonna preface this by saying I'm not super sure about this one.

## Background

I'm trying to track down why the prefilight poll sometimes terminates when there are no duplicates. Excerpt from the logs.

```
[info] Continue Poll Patch 10349 prerun
[info] Code review status: Label Check true Passed Status: false Passed Review: sufficient CODEOWNERS: true Passed Up-To-Date Review: sufficient
<Some GitHub webhooks happen>
[info] Continue Poll Patch 10349 prerun
[info] Patch 10349 already left prerun, exiting prerun poll loop
```

I see the extra `already left prerun` check was added in #841 and its only supposed to remove duplicate `bors r+/merge` requests. But I don't see any duplicate requests here: the timestamps of `Continue Poll` are about a minute apart and there are no new `Start Poll Patch`).

I see other cases where Bors comments with "Waiting for PR Status" and then doesn't comment again (or merge) and suspect is a similar issue, but the logs are too far back and we don't have then anymore.

Since the polling silently stops, its quite frustrating for devs who have to `bors r+` again.

## Solution

In this PR, Bors adds a GitHub comment when it stops polling due to duplicates. This should both inform devs and help track down this issue.

## Drawbacks

This add an extra comment from Bors, which may sometimes be confusing. But if people made multiple requests, they should understand the messages referring to duplicates. It is only in the case where the preflight polling stopped due to something else where the message would be confusing. But I'm thinking even in that case, its better they are informed.

Co-authored-by: zli <zli@simspace.com>
  • Loading branch information
bors[bot] and zli-simspace committed Nov 18, 2020
2 parents f5dc2d7 + 240d795 commit 43fa67f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/worker/batcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,15 @@ defmodule BorsNG.Worker.Batcher do

Logger.info("Continue Poll Patch #{patch.id} prerun")

project = Repo.get(Project, patch.project_id)
repo_conn = get_repo_conn(project)

case Repo.get(Patch.all(:awaiting_review), patch.id) do
nil ->
send_message(repo_conn, [patch], {:preflight, :duplicate})
Logger.info("Patch #{patch.id} already left prerun, exiting prerun poll loop")

_ ->
project = Repo.get(Project, patch.project_id)
repo_conn = get_repo_conn(project)
{:ok, toml} = Batcher.GetBorsToml.get(repo_conn, patch.commit)

prerun_timeout_ms = toml.prerun_timeout_sec * 1000
Expand Down
4 changes: 4 additions & 0 deletions lib/worker/batcher/message.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ defmodule BorsNG.Worker.Batcher.Message do
"All preflight checks passed. Batching this PR into the staging branch."
end

def generate_message({:preflight, :duplicate}) do
"Stopped waiting for PR status (Github check) without running due to duplicate requests to run. You may check Bors to see that this PR is included in a batch by one of the other requests."
end

def generate_message({:preflight, :timeout}) do
"GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like."
end
Expand Down
2 changes: 2 additions & 0 deletions test/batcher/batcher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,8 @@ defmodule BorsNG.Worker.BatcherTest do
commits: %{},
comments: %{
1 => [
"Stopped waiting for PR status (Github check) without running due to duplicate requests to run. You may check Bors to see that this PR is included in a batch by one of the other requests.",
"Stopped waiting for PR status (Github check) without running due to duplicate requests to run. You may check Bors to see that this PR is included in a batch by one of the other requests.",
":clock1: Waiting for PR status (Github check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set."
]
},
Expand Down

0 comments on commit 43fa67f

Please sign in to comment.