From e70dbb5a810716ad72f286ba893d2c3bb15ad300 Mon Sep 17 00:00:00 2001 From: cheetah Date: Fri, 7 Jul 2023 23:30:24 -0500 Subject: [PATCH] mew --- main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 9d712d9..5e591a7 100644 --- a/main.go +++ b/main.go @@ -343,7 +343,7 @@ func modeIngress(folderPath string, skipN int) { defer tracker.Increment(1) err = ProcessGMA(pw, jobFile) if err != nil { - log.Printf("\nERROR: %v\n", err) + pw.Log(fmt.Sprintf("\nERROR: %v\n", err)) } }(jobFile, &wg) @@ -400,6 +400,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) { } defer cursor.Close() + initialRetryCounter := 0 skipHashCheck := false if cursor.Count() > 0 || cursor.HasMore() { for { @@ -413,7 +414,15 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) { if gma.Success { return fmt.Errorf("GMA with ID %s was successfull at %v", gma.ID, gma.ProcessingEnd) } else { + if gma.RetryCounter > 3 { + return fmt.Errorf("GMA with ID %s was too many times unsuccessfull", gma.ID) + } skipHashCheck = true + initialRetryCounter = gma.RetryCounter + 1 + _, err = colGMA.UpdateDocument(arangoCTX, gma.ID, &gma) + if err != nil { + return err + } } } } @@ -424,6 +433,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) { } dboGMA.StatModTime = fileStat.ModTime() dboGMA.GMASize = fileStat.Size() + dboGMA.RetryCounter = initialRetryCounter + 1 if dboGMA.GMASize < 200 { return fmt.Errorf("GMA File too small, skipping") @@ -557,7 +567,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) { trackerProcess.Increment(1) } if len(files) < 1 { - return fmt.Errorf("GMA empty, len=%d", len(files)) + return fmt.Errorf("GMA %s empty, len=%d", dboGMA.OriginalPath, len(files)) } lastFile := files[len(files)-1]