changeset 5113:d036ad682013 queued-stage-done

Spell trys as tries.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 25 Mar 2020 17:50:07 +0100
parents 4c113aa9a521
children da26076ffafe
files pkg/imports/queue.go
diffstat 1 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/queue.go	Wed Mar 25 17:44:26 2020 +0100
+++ b/pkg/imports/queue.go	Wed Mar 25 17:50:07 2020 +0100
@@ -107,7 +107,7 @@
 		kind      JobKind
 		user      string
 		waitRetry pgtype.Interval
-		trysLeft  sql.NullInt64
+		triesLeft sql.NullInt64
 		sendEmail bool
 		data      string
 	}
@@ -119,9 +119,9 @@
 )
 
 const (
-	ReviewJobSuffix = "#review"
-	reviewJobRetrys = 10
-	reviewJobWait   = time.Minute
+	ReviewJobSuffix  = "#review"
+	reviewJobRetries = 10
+	reviewJobWait    = time.Minute
 )
 
 type importQueue struct {
@@ -407,15 +407,15 @@
 
 func (idj *idJob) nextRetry(feedback Feedback) bool {
 	switch {
-	case idj.waitRetry.Status != pgtype.Present && !idj.trysLeft.Valid:
+	case idj.waitRetry.Status != pgtype.Present && !idj.triesLeft.Valid:
 		return false
-	case idj.waitRetry.Status == pgtype.Present && !idj.trysLeft.Valid:
+	case idj.waitRetry.Status == pgtype.Present && !idj.triesLeft.Valid:
 		return true
-	case idj.trysLeft.Valid:
-		if idj.trysLeft.Int64 < 1 {
-			feedback.Warn("import should be retried, but no retrys left")
+	case idj.triesLeft.Valid:
+		if idj.triesLeft.Int64 < 1 {
+			feedback.Warn("import should be retried, but no retries left")
 		} else {
-			idj.trysLeft.Int64--
+			idj.triesLeft.Int64--
 			feedback.Info("import failed but will be retried")
 			return true
 		}
@@ -436,11 +436,11 @@
 	return now
 }
 
-func (idj *idJob) trysLeftPointer() *int {
-	if !idj.trysLeft.Valid {
+func (idj *idJob) triesLeftPointer() *int {
+	if !idj.triesLeft.Valid {
 		return nil
 	}
-	t := int(idj.trysLeft.Int64)
+	t := int(idj.triesLeft.Int64)
 	return &t
 }
 
@@ -489,7 +489,7 @@
 func (q *importQueue) addJob(
 	kind JobKind,
 	due time.Time,
-	trysLeft *int,
+	triesLeft *int,
 	waitRetry *time.Duration,
 	user string,
 	sendEmail bool,
@@ -503,8 +503,8 @@
 	due = due.UTC()
 
 	var tl sql.NullInt64
-	if trysLeft != nil {
-		tl = sql.NullInt64{Int64: int64(*trysLeft), Valid: true}
+	if triesLeft != nil {
+		tl = sql.NullInt64{Int64: int64(*triesLeft), Valid: true}
 	}
 
 	var wr pgtype.Interval
@@ -545,7 +545,7 @@
 func AddJob(
 	kind JobKind,
 	due time.Time,
-	trysLeft *int,
+	triesLeft *int,
 	waitRetry *time.Duration,
 	user string,
 	sendEmail bool,
@@ -554,7 +554,7 @@
 	return iqueue.addJob(
 		kind,
 		due,
-		trysLeft,
+		triesLeft,
 		waitRetry,
 		user,
 		sendEmail,
@@ -627,13 +627,13 @@
 	}
 
 	// Try a little harder to persist the decision.
-	trys := reviewJobRetrys
+	tries := reviewJobRetries
 	wait := reviewJobWait
 
 	rID, err := q.addJob(
 		JobKind(kind+ReviewJobSuffix),
 		time.Now(),
-		&trys,
+		&tries,
 		&wait,
 		reviewer,
 		false,
@@ -779,7 +779,7 @@
 		if err = tx.QueryRowContext(ctx, selectJobSQL, &kinds).Scan(
 			&ji.id,
 			&ji.kind,
-			&ji.trysLeft,
+			&ji.triesLeft,
 			&ji.waitRetry,
 			&ji.user,
 			&ji.sendEmail,
@@ -999,7 +999,7 @@
 				nid, err := q.addJob(
 					idj.kind,
 					idj.nextDue(),
-					idj.trysLeftPointer(),
+					idj.triesLeftPointer(),
 					idj.waitRetryPointer(),
 					idj.user, idj.sendEmail,
 					idj.data)