sync: Don't pull repo when doing synchronization. Do it only on auto-sync
This commit is contained in:
parent
ac64db277a
commit
5fb85c22dc
5 changed files with 17 additions and 16 deletions
|
@ -21,17 +21,11 @@ var oneThemeDeepSync sync.Mutex
|
|||
// DeepSyncProgress expose the progression of the depp synchronization (0 = 0%, 255 = 100%).
|
||||
var DeepSyncProgress uint8
|
||||
|
||||
// avoidImporterSync checks if Sync should be called or not.
|
||||
func avoidImporterSync() bool {
|
||||
return DeepSyncProgress > 1 && DeepSyncProgress < 255
|
||||
}
|
||||
|
||||
type SyncReport struct {
|
||||
DateStart time.Time `json:"_started"`
|
||||
DateEnd time.Time `json:"_ended"`
|
||||
DateUpdated []time.Time `json:"_updated"`
|
||||
Regeneration []string `json:"_regeneration"`
|
||||
SyncError error `json:"_sync,omitempty"`
|
||||
SyncId string `json:"_id,omitempty"`
|
||||
ThemesSync []string `json:"_themes,omitempty"`
|
||||
Themes map[string][]string `json:"themes"`
|
||||
|
@ -116,10 +110,6 @@ func SyncDeep(i Importer) (errs SyncReport) {
|
|||
|
||||
startTime := time.Now()
|
||||
|
||||
if err := i.Sync(); err != nil {
|
||||
errs.SyncError = err
|
||||
}
|
||||
|
||||
errs.DateStart = startTime
|
||||
exceptions, sterrs := SyncThemes(i)
|
||||
for _, sterr := range sterrs {
|
||||
|
@ -206,12 +196,6 @@ func SyncThemeDeep(i Importer, theme *fic.Theme, tid int, themeStep uint8, excep
|
|||
oneThemeDeepSync.Lock()
|
||||
defer oneThemeDeepSync.Unlock()
|
||||
|
||||
if !avoidImporterSync() {
|
||||
if err := i.Sync(); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
DeepSyncProgress = 3 + uint8(tid)*themeStep
|
||||
errs = SyncExercices(i, theme, exceptions)
|
||||
|
||||
|
|
Reference in a new issue