mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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()
This commit is contained in:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user