aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorJonas Bröms <9416498+cez81@users.noreply.github.com>2018-11-09 00:58:02 +0100
committertechknowlogick <hello@techknowlogick.com>2018-11-08 18:58:02 -0500
commit599adde1bc3670279d371fd9f2620c2829286bf6 (patch)
treea7d2dce94f1328a9c504478d9a2a8b49265a0811 /models
parentde8f98192b113fde31c6361584b624c48de83895 (diff)
downloadgitea-599adde1bc3670279d371fd9f2620c2829286bf6.tar.gz
gitea-599adde1bc3670279d371fd9f2620c2829286bf6.zip
Add option to disable automatic mirror syncing. (#5242)
Setting the interval to 0 will disable to automatic syncing.
Diffstat (limited to 'models')
-rw-r--r--models/repo_mirror.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index 447d055307..9f8c9bee65 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -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 {