#835: Realtime webhooks

This commit is contained in:
Unknwon 2015-07-25 21:32:04 +08:00
parent 2b1442f3df
commit fa298a2c30
13 changed files with 140 additions and 69 deletions

View file

@ -68,6 +68,7 @@ func GlobalInit() {
models.HasEngine = true
cron.NewCronContext()
models.InitDeliverHooks()
log.NewGitLogger(path.Join(setting.LogRootPath, "http.log"))
}
if models.EnableSQLite3 {

View file

@ -190,7 +190,10 @@ func Http(ctx *middleware.Context) {
refName := fields[2]
// FIXME: handle error.
models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id)
if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil {
models.HookQueue.AddRepoID(repo.Id)
}
}
lastLine = lastLine + size
} else {

View file

@ -634,3 +634,7 @@ func GitHooksEditPost(ctx *middleware.Context) {
}
ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks/git")
}
func TriggerHook(ctx *middleware.Context) {
models.HookQueue.AddRepoID(ctx.Repo.Repository.Id)
}