mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add option to disable automatic mirror syncing. (#5242)
Setting the interval to 0 will disable to automatic syncing.
This commit is contained in:
committed by
techknowlogick
parent
de8f98192b
commit
599adde1bc
@@ -63,7 +63,11 @@ func (m *Mirror) AfterLoad(session *xorm.Session) {
|
||||
|
||||
// ScheduleNextUpdate calculates and sets next update time.
|
||||
func (m *Mirror) ScheduleNextUpdate() {
|
||||
m.NextUpdateUnix = util.TimeStampNow().AddDuration(m.Interval)
|
||||
if m.Interval != 0 {
|
||||
m.NextUpdateUnix = util.TimeStampNow().AddDuration(m.Interval)
|
||||
} else {
|
||||
m.NextUpdateUnix = 0
|
||||
}
|
||||
}
|
||||
|
||||
func remoteAddress(repoPath string) (string, error) {
|
||||
@@ -302,6 +306,7 @@ func MirrorUpdate() {
|
||||
|
||||
if err := x.
|
||||
Where("next_update_unix<=?", time.Now().Unix()).
|
||||
And("next_update_unix!=0").
|
||||
Iterate(new(Mirror), func(idx int, bean interface{}) error {
|
||||
m := bean.(*Mirror)
|
||||
if m.Repo == nil {
|
||||
|
Reference in New Issue
Block a user