MCPcopy Create free account
hub / github.com/gogs/gogs / MirrorUpdate

Function MirrorUpdate

internal/database/mirror.go:361–382  ·  view source on GitHub ↗

MirrorUpdate checks and updates mirror repositories.

()

Source from the content-addressed store, hash-verified

359
360// MirrorUpdate checks and updates mirror repositories.
361func MirrorUpdate() {
362 if taskStatusTable.IsRunning(taskNameMirrorUpdate) {
363 return
364 }
365 taskStatusTable.Start(taskNameMirrorUpdate)
366 defer taskStatusTable.Stop(taskNameMirrorUpdate)
367
368 log.Trace("Doing: MirrorUpdate")
369
370 if err := x.Where("next_update_unix<=?", time.Now().Unix()).Iterate(new(Mirror), func(idx int, bean any) error {
371 m := bean.(*Mirror)
372 if m.Repo == nil {
373 log.Error("Disconnected mirror repository found: %d", m.ID)
374 return nil
375 }
376
377 MirrorQueue.Add(m.RepoID)
378 return nil
379 }); err != nil {
380 log.Error("MirrorUpdate: %v", err)
381 }
382}
383
384// SyncMirrors checks and syncs mirrors.
385// TODO: sync more mirrors at same time.

Callers 1

NewContextFunction · 0.92

Calls 7

IsRunningMethod · 0.80
StopMethod · 0.80
IterateMethod · 0.80
WhereMethod · 0.80
AddMethod · 0.80
StartMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected