sync: add logs on stderr when doing deepsync
This commit is contained in:
parent
d97ecde3fb
commit
9693940d8c
@ -24,12 +24,18 @@ var DeepSyncProgress uint8
|
|||||||
// SyncDeep performs a recursive synchronisation: from themes to challenge items.
|
// SyncDeep performs a recursive synchronisation: from themes to challenge items.
|
||||||
func SyncDeep(i Importer) (errs map[string][]string) {
|
func SyncDeep(i Importer) (errs map[string][]string) {
|
||||||
oneDeepSync.Lock()
|
oneDeepSync.Lock()
|
||||||
defer oneDeepSync.Unlock()
|
defer func(){
|
||||||
|
oneDeepSync.Unlock()
|
||||||
|
if DeepSyncProgress != 255 {
|
||||||
|
log.Printf("Full synchronization terminated at step %d/255", DeepSyncProgress)
|
||||||
|
}
|
||||||
|
}()
|
||||||
DeepSyncProgress = 1
|
DeepSyncProgress = 1
|
||||||
|
|
||||||
errs = map[string][]string{}
|
errs = map[string][]string{}
|
||||||
|
|
||||||
errs["_date"] = []string{fmt.Sprintf("%v", time.Now())}
|
startTime := time.Now()
|
||||||
|
errs["_date"] = []string{fmt.Sprintf("%v", startTime)}
|
||||||
errs["_themes"] = SyncThemes(i)
|
errs["_themes"] = SyncThemes(i)
|
||||||
|
|
||||||
if themes, err := fic.GetThemes(); err == nil {
|
if themes, err := fic.GetThemes(); err == nil {
|
||||||
@ -43,6 +49,8 @@ func SyncDeep(i Importer) (errs map[string][]string) {
|
|||||||
if exercices, err := theme.GetExercices(); err == nil {
|
if exercices, err := theme.GetExercices(); err == nil {
|
||||||
var exerciceStep uint8 = themeStep / uint8(len(exercices))
|
var exerciceStep uint8 = themeStep / uint8(len(exercices))
|
||||||
for eid, exercice := range exercices {
|
for eid, exercice := range exercices {
|
||||||
|
log.Printf("Full synchronization in progress: %d/255 - doing Theme %q, Exercice %q: %q\n", DeepSyncProgress, theme.Name, exercice.Title, exercice.Path)
|
||||||
|
|
||||||
DeepSyncProgress = 3 + uint8(tid) * themeStep + uint8(eid) * exerciceStep
|
DeepSyncProgress = 3 + uint8(tid) * themeStep + uint8(eid) * exerciceStep
|
||||||
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...)
|
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...)
|
||||||
|
|
||||||
@ -82,5 +90,6 @@ func SyncDeep(i Importer) (errs map[string][]string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeepSyncProgress = 255
|
DeepSyncProgress = 255
|
||||||
|
log.Println("Full synchronization done in", time.Since(startTime))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user