mirror of
https://github.com/go-gitea/gitea.git
synced 2024-10-29 08:17:31 -04:00
fix potential sqlite lock #1680
This commit is contained in:
commit
a85c5ab9ff
@ -612,18 +612,16 @@ func (t *HookTask) deliver() {
|
|||||||
// TODO: shoot more hooks at same time.
|
// TODO: shoot more hooks at same time.
|
||||||
func DeliverHooks() {
|
func DeliverHooks() {
|
||||||
tasks := make([]*HookTask, 0, 10)
|
tasks := make([]*HookTask, 0, 10)
|
||||||
x.
|
err := x.Where("is_delivered=?", false).Find(&tasks)
|
||||||
Where("is_delivered=?", false).
|
if err != nil {
|
||||||
Iterate(new(HookTask),
|
log.Error(4, "DeliverHooks: %v", err)
|
||||||
func(idx int, bean interface{}) error {
|
return
|
||||||
t := bean.(*HookTask)
|
}
|
||||||
t.deliver()
|
|
||||||
tasks = append(tasks, t)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
// Update hook task status.
|
// Update hook task status.
|
||||||
for _, t := range tasks {
|
for _, t := range tasks {
|
||||||
|
t.deliver()
|
||||||
|
|
||||||
if err := UpdateHookTask(t); err != nil {
|
if err := UpdateHookTask(t); err != nil {
|
||||||
log.Error(4, "UpdateHookTask [%d]: %v", t.ID, err)
|
log.Error(4, "UpdateHookTask [%d]: %v", t.ID, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user