}
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go webhook_module.HookQueue.Add(issue.RepoID)
}
}
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks [repo_id: %d]: %v", oldRepo.ID, err)
- } else {
- go webhook_module.HookQueue.Add(oldRepo.ID)
}
u := repo.MustOwner()
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
- } else {
- go webhook_module.HookQueue.Add(repo.ID)
}
}
}
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
- } else {
- go webhook_module.HookQueue.Add(repo.ID)
}
}
}
}); err != nil {
log.Error("PrepareWebhooks [repo_id: %d]: %v", repo.ID, err)
}
- go webhook_module.HookQueue.Add(repo.ID)
}
}
return
}
}
-
- go webhook_module.HookQueue.Add(issue.RepoID)
}
func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) {
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go webhook_module.HookQueue.Add(issue.RepoID)
}
}
}
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v, is_closed: %v]: %v", issue.IsPull, isClosed, err)
- } else {
- go webhook_module.HookQueue.Add(issue.Repo.ID)
}
}
Sender: issue.Poster.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook_module.HookQueue.Add(issue.RepoID)
}
}
}
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go webhook_module.HookQueue.Add(issue.RepoID)
}
}
IsPull: c.Issue.IsPull,
}); err != nil {
log.Error("PrepareWebhooks [comment_id: %d]: %v", c.ID, err)
- } else {
- go webhook_module.HookQueue.Add(c.Issue.Repo.ID)
}
}
IsPull: issue.IsPull,
}); err != nil {
log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
- } else {
- go webhook_module.HookQueue.Add(repo.ID)
}
}
IsPull: comment.Issue.IsPull,
}); err != nil {
log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
- } else {
- go webhook_module.HookQueue.Add(comment.Issue.Repo.ID)
}
}
}
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go webhook_module.HookQueue.Add(issue.RepoID)
}
}
return fmt.Errorf("NotifyWatchers: %v", err)
}
- defer func() {
- go webhook.HookQueue.Add(repo.ID)
- }()
-
apiPusher := pusher.APIFormat()
apiRepo := repo.APIFormat(models.AccessModeNone)
}
// Start listening on new hook requests.
- for repoIDStr := range HookQueue.Queue() {
+ for repoIDStr := range hookQueue.Queue() {
log.Trace("DeliverHooks [repo_id: %v]", repoIDStr)
- HookQueue.Remove(repoIDStr)
+ hookQueue.Remove(repoIDStr)
repoID, err := com.StrTo(repoIDStr).Int64()
if err != nil {
"github.com/gobwas/glob"
)
-// HookQueue is a global queue of web hooks
-var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
+// hookQueue is a global queue of web hooks
+var hookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
// getPayloadBranch returns branch for hook event, if applicable.
func getPayloadBranch(p api.Payloader) string {
// PrepareWebhook adds special webhook to task queue for given payload.
func PrepareWebhook(w *models.Webhook, repo *models.Repository, event models.HookEventType, p api.Payloader) error {
- return prepareWebhook(w, repo, event, p)
+ if err := prepareWebhook(w, repo, event, p); err != nil {
+ return err
+ }
+
+ go hookQueue.Add(repo.ID)
+ return nil
}
func checkBranch(w *models.Webhook, branch string) bool {
// PrepareWebhooks adds new webhooks to task queue for given payload.
func PrepareWebhooks(repo *models.Repository, event models.HookEventType, p api.Payloader) error {
- return prepareWebhooks(repo, event, p)
+ if err := prepareWebhooks(repo, event, p); err != nil {
+ return err
+ }
+
+ go hookQueue.Add(repo.ID)
+ return nil
}
func prepareWebhooks(repo *models.Repository, event models.HookEventType, p api.Payloader) error {
ctx.Error(500, "PrepareWebhook: ", err)
return
}
- go webhook.HookQueue.Add(ctx.Repo.Repository.ID)
+
ctx.Status(204)
}
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
- "code.gitea.io/gitea/modules/webhook"
"code.gitea.io/gitea/services/gitdiff"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"
log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)
- go webhook.HookQueue.Add(repo.ID)
go pull_service.AddTestPullRequestTask(pusher, repo.ID, branch, true)
ctx.Status(202)
}
ctx.Flash.Error("PrepareWebhook: " + err.Error())
ctx.Status(500)
} else {
- go webhook.HookQueue.Add(ctx.Repo.Repository.ID)
ctx.Flash.Info(ctx.Tr("repo.settings.webhook.test_delivery_success"))
ctx.Status(200)
}
}
if err != nil {
log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go webhook.HookQueue.Add(issue.RepoID)
}
return nil
}
return fmt.Errorf("notifyWatchers: %v", err)
}
- defer func() {
- go webhook.HookQueue.Add(repo.ID)
- }()
-
return nil
}
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook.HookQueue.Add(pr.Issue.Repo.ID)
}
return nil
Sender: pull.Poster.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook.HookQueue.Add(repo.ID)
}
return nil
log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err)
continue
}
- go webhook.HookQueue.Add(pr.Issue.Repo.ID)
}
}
if err != nil {
return err
}
- if err := webhook.PrepareWebhooks(review.Issue.Repo, reviewHookType, &api.PullRequestPayload{
+ return webhook.PrepareWebhooks(review.Issue.Repo, reviewHookType, &api.PullRequestPayload{
Action: api.HookIssueSynchronized,
Index: review.Issue.Index,
PullRequest: pr.APIFormat(),
Type: string(reviewHookType),
Content: review.Content,
},
- }); err != nil {
- return err
- }
- go webhook.HookQueue.Add(review.Issue.Repo.ID)
-
- return nil
+ })
}
Sender: rel.Publisher.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook.HookQueue.Add(rel.Repo.ID)
}
}
}
Sender: doer.APIFormat(),
}); err1 != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook.HookQueue.Add(rel.Repo.ID)
}
return err
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
- } else {
- go webhook.HookQueue.Add(rel.Repo.ID)
}
return nil