summaryrefslogtreecommitdiffstats
path: root/models/repo_mirror.go
diff options
context:
space:
mode:
authorJonas <cez81@users.noreply.github.com>2017-04-08 17:27:26 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-04-08 23:27:26 +0800
commit54f0293f0ab73f357f545f8e05d16f9b254aba5e (patch)
treeb95f86dd93e7c74cada06a919d7f790c2ca1d083 /models/repo_mirror.go
parentedbb9eefd6c12d6c67bf864539a51f5a09c7d670 (diff)
downloadgitea-54f0293f0ab73f357f545f8e05d16f9b254aba5e.tar.gz
gitea-54f0293f0ab73f357f545f8e05d16f9b254aba5e.zip
Mirror sync interval specified as duration string (#1407)
* Sync interval specifed as duration string * Changed mirror interval text * make fmt * Add MinInterval for mirror sync * Use duration internally * Changed min default to 10m * make fmt * Incorrect default * Removed defaults in MustDuration() * Add Mirror interval migration * Default values corrected * Use transaction during migration * Change http 500 to page with error message * Cleanup session.commit()
Diffstat (limited to 'models/repo_mirror.go')
-rw-r--r--models/repo_mirror.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index d8d4bc0bec..67ae449bde 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -27,8 +27,8 @@ type Mirror struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
Repo *Repository `xorm:"-"`
- Interval int // Hour.
- EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
+ Interval time.Duration
+ EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
Updated time.Time `xorm:"-"`
UpdatedUnix int64 `xorm:"INDEX"`
@@ -68,7 +68,7 @@ func (m *Mirror) AfterSet(colName string, _ xorm.Cell) {
// ScheduleNextUpdate calculates and sets next update time.
func (m *Mirror) ScheduleNextUpdate() {
- m.NextUpdate = time.Now().Add(time.Duration(m.Interval) * time.Hour)
+ m.NextUpdate = time.Now().Add(m.Interval)
}
func (m *Mirror) readAddress() {