File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ func (c *Connection) streamResponses(
9292 eventC := make (chan * pb.Operation_Event )
9393 errC := make (chan error )
9494 ticker := time .NewTicker (5 * time .Second )
95- var mostRecentEventPublishedAt time.Time
9695 var lastEvent * pb.Operation_Event
9796
9897 // Start the operation event stream poller
@@ -139,11 +138,13 @@ func (c *Connection) streamResponses(
139138 "operation_id" , ref .GetId (),
140139 "published_at" , event .GetPublishedAt (),
141140 )
142- lastEvent = event
143141
144- if mostRecent := event .GetPublishedAt ().AsTime (); mostRecent .After (mostRecentEventPublishedAt ) {
145- // Only publish events that are newer than our last event
146- mostRecentEventPublishedAt = mostRecent
142+ if lastEvent == nil || event .GetPublishedAt ().AsTime ().After (lastEvent .GetPublishedAt ().AsTime ()) {
143+ // Because our events are not guaranteed to be in order
144+ // we'll only update our last event if it was published
145+ // more recently. This ensures that when we "replay"
146+ // events while waiting we always show the most recent.
147+ lastEvent = event
147148 ui .ShowOperationEvent (event )
148149 ticker .Reset (5 * time .Second )
149150 }
You can’t perform that action at this time.
0 commit comments