File tree Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ package model
1616
1717import (
1818 "fmt"
19+ "math"
1920 "strings"
2021 "time"
2122
@@ -488,36 +489,17 @@ func (h History) Len() int {
488489
489490func (h History ) Operations () []porcupine.Operation {
490491 operations := make ([]porcupine.Operation , 0 , len (h .operations ))
491- maxTime := h .lastObservedTime ()
492492 for _ , op := range h .operations {
493493 // Failed requests don't have a known return time.
494494 if op .Return == - 1 {
495- // Simulate Infinity by using last observed time.
496- op .Return = maxTime + time . Second . Nanoseconds ()
495+ // Simulate infinity for failed requests
496+ op .Return = math . MaxInt64
497497 }
498498 operations = append (operations , op )
499499 }
500500 return operations
501501}
502502
503- func (h History ) lastObservedTime () int64 {
504- var maxTime int64
505- for _ , op := range h .operations {
506- if op .Return == - 1 {
507- // Collect call time from failed operations
508- if op .Call > maxTime {
509- maxTime = op .Call
510- }
511- } else {
512- // Collect return time from successful operations
513- if op .Return > maxTime {
514- maxTime = op .Return
515- }
516- }
517- }
518- return maxTime
519- }
520-
521503func (h History ) MaxRevision () int64 {
522504 var maxRevision int64
523505 for _ , op := range h .operations {
You can’t perform that action at this time.
0 commit comments