From 162d9b3a674d6099a269bd2cfe8166479c46ad64 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 25 Jul 2017 13:57:13 -0400 Subject: [PATCH] fix issue #2138 --- server/hook.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/hook.go b/server/hook.go index b6513efe5..98a56d212 100644 --- a/server/hook.go +++ b/server/hook.go @@ -159,9 +159,13 @@ func PostHook(c *gin.Context) { } err = Config.Storage.Config.ConfigCreate(conf) if err != nil { - logrus.Errorf("failure to persist config for %s. %s", repo.FullName, err) - c.AbortWithError(500, err) - return + // retry in case we receive two hooks at the same time + conf, err = Config.Storage.Config.ConfigFind(repo, sha) + if err != nil { + logrus.Errorf("failure to find or persist build config for %s. %s", repo.FullName, err) + c.AbortWithError(500, err) + return + } } } build.ConfigID = conf.ID