Skip to content

Commit 6b2ee65

Browse files
authored
handle crashes in goroutine events (#1857)
1 parent 15b7491 commit 6b2ee65

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

backend/controllers/github.go

+12
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ func handleInstallationDeletedEvent(installation *github.InstallationEvent, appI
309309
}
310310

311311
func handlePullRequestEvent(gh utils.GithubClientProvider, payload *github.PullRequestEvent, ciBackendProvider ci_backends.CiBackendProvider, appId int64) error {
312+
defer func() {
313+
if r := recover(); r != nil {
314+
log.Printf("Recovered from panic in handlePullRequestEvent handler: %v", r)
315+
}
316+
}()
317+
312318
installationId := *payload.Installation.ID
313319
repoName := *payload.Repo.Name
314320
repoOwner := *payload.Repo.Owner.Login
@@ -684,6 +690,12 @@ func getBatchType(jobs []orchestrator_scheduler.Job) orchestrator_scheduler.Digg
684690
}
685691

686692
func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.IssueCommentEvent, ciBackendProvider ci_backends.CiBackendProvider, appId int64, postCommentHooks []IssueCommentHook) error {
693+
defer func() {
694+
if r := recover(); r != nil {
695+
log.Printf("Recovered from panic in handleIssueCommentEvent handler: %v", r)
696+
}
697+
}()
698+
687699
installationId := *payload.Installation.ID
688700
repoName := *payload.Repo.Name
689701
repoOwner := *payload.Repo.Owner.Login

0 commit comments

Comments
 (0)