Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SQL type error for webhooks #3424

Merged
merged 2 commits into from
Jan 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions models/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea"

"github.com/Unknwon/com"
gouuid "github.com/satori/go.uuid"
)

Expand Down Expand Up @@ -677,9 +678,15 @@ func DeliverHooks() {
}

// Start listening on new hook requests.
for repoID := range HookQueue.Queue() {
log.Trace("DeliverHooks [repo_id: %v]", repoID)
HookQueue.Remove(repoID)
for repoIDStr := range HookQueue.Queue() {
log.Trace("DeliverHooks [repo_id: %v]", repoIDStr)
HookQueue.Remove(repoIDStr)

repoID, err := com.StrTo(repoIDStr).Int64()
if err != nil {
log.Error(4, "Invalid repo ID: %s", repoIDStr)
continue
}

tasks = make([]*HookTask, 0, 5)
if err := x.Where("repo_id=? AND is_delivered=?", repoID, false).Find(&tasks); err != nil {
Expand Down