mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 13:37:52 +01:00
This commit is contained in:
parent
cfed11f092
commit
1b7adf57e9
@ -77,7 +77,7 @@ func getEngine() (*xorm.Engine, error) {
|
||||
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||
cnnstr = DbCfg.Path
|
||||
cnnstr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc"
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
|
@ -236,6 +236,7 @@ func UpdateHookTask(t *HookTask) error {
|
||||
|
||||
// DeliverHooks checks and delivers undelivered hooks.
|
||||
func DeliverHooks() {
|
||||
tasks := make([]*HookTask, 0, 10)
|
||||
timeout := time.Duration(setting.WebhookDeliverTimeout) * time.Second
|
||||
x.Where("is_delivered=?", false).Iterate(new(HookTask),
|
||||
func(idx int, bean interface{}) error {
|
||||
@ -283,12 +284,18 @@ func DeliverHooks() {
|
||||
}
|
||||
}
|
||||
|
||||
if err := UpdateHookTask(t); err != nil {
|
||||
log.Error(4, "UpdateHookTask: %v", err)
|
||||
return nil
|
||||
}
|
||||
tasks = append(tasks, t)
|
||||
|
||||
if t.IsSucceed {
|
||||
log.Trace("Hook delivered(%s): %s", t.Uuid, t.PayloadContent)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// Update hook task status.
|
||||
for _, t := range tasks {
|
||||
if err := UpdateHookTask(t); err != nil {
|
||||
log.Error(4, "UpdateHookTask(%d): %v", t.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user