@@ -94,7 +94,7 @@ func TestAgentConnectionMonitor_ContextCancel(t *testing.T) {
9494Return (nil )
9595mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
9696gomock .Any (),
97- connectionUpdate (agentID ,replicaID ,withDisconnectedAfter (now )),
97+ connectionUpdate (agentID ,replicaID ,withDisconnectedNotBefore (now )),
9898).
9999After (connected ).
100100Times (1 ).
@@ -172,7 +172,7 @@ func TestAgentConnectionMonitor_PingTimeout(t *testing.T) {
172172Return (nil )
173173mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
174174gomock .Any (),
175- connectionUpdate (agent .ID ,replicaID ,withDisconnectedAfter (now )),
175+ connectionUpdate (agent .ID ,replicaID ,withDisconnectedNotBefore (now )),
176176).
177177After (connected ).
178178Times (1 ).
@@ -235,7 +235,7 @@ func TestAgentConnectionMonitor_BuildOutdated(t *testing.T) {
235235Return (nil )
236236mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
237237gomock .Any (),
238- connectionUpdate (agent .ID ,replicaID ,withDisconnectedAfter (now )),
238+ connectionUpdate (agent .ID ,replicaID ,withDisconnectedNotBefore (now )),
239239).
240240After (connected ).
241241Times (1 ).
@@ -320,7 +320,7 @@ func TestAgentConnectionMonitor_StartClose(t *testing.T) {
320320Return (nil )
321321mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
322322gomock .Any (),
323- connectionUpdate (agent .ID ,replicaID ,withDisconnectedAfter (now )),
323+ connectionUpdate (agent .ID ,replicaID ,withDisconnectedNotBefore (now )),
324324).
325325After (connected ).
326326Times (1 ).
@@ -423,10 +423,10 @@ func (f *fakeUpdater) getUpdates() int {
423423}
424424
425425type connectionUpdateMatcher struct {
426- agentID uuid.UUID
427- replicaID uuid.UUID
428- disconnectedAt sql.NullTime
429- disconnectedAfter sql.NullTime
426+ agentID uuid.UUID
427+ replicaID uuid.UUID
428+ disconnectedAt sql.NullTime
429+ disconnectedNotBefore sql.NullTime
430430}
431431
432432type connectionUpdateMatcherOption func (m connectionUpdateMatcher )connectionUpdateMatcher
@@ -442,9 +442,9 @@ func connectionUpdate(id, replica uuid.UUID, opts ...connectionUpdateMatcherOpti
442442return m
443443}
444444
445- func withDisconnectedAfter (t time.Time )connectionUpdateMatcherOption {
445+ func withDisconnectedNotBefore (t time.Time )connectionUpdateMatcherOption {
446446return func (m connectionUpdateMatcher )connectionUpdateMatcher {
447- m .disconnectedAfter = sql.NullTime {
447+ m .disconnectedNotBefore = sql.NullTime {
448448Valid :true ,
449449Time :t ,
450450}
@@ -476,23 +476,23 @@ func (m connectionUpdateMatcher) Matches(x interface{}) bool {
476476if args .LastConnectedReplicaID .UUID != m .replicaID {
477477return false
478478}
479- if m .disconnectedAfter .Valid {
479+ if m .disconnectedNotBefore .Valid {
480480if ! args .DisconnectedAt .Valid {
481481return false
482482}
483- if ! args .DisconnectedAt .Time .After (m .disconnectedAfter .Time ) {
483+ if args .DisconnectedAt .Time .Before (m .disconnectedNotBefore .Time ) {
484484return false
485485}
486- //disconnectedAfter takes precedence over disconnectedAt
486+ //disconnectedNotBefore takes precedence over disconnectedAt
487487}else if args .DisconnectedAt != m .disconnectedAt {
488488return false
489489}
490490return true
491491}
492492
493493func (m connectionUpdateMatcher )String ()string {
494- return fmt .Sprintf ("{agent=%s, replica=%s, disconnectedAt=%v,disconnectedAfter =%v}" ,
495- m .agentID .String (),m .replicaID .String (),m .disconnectedAt ,m .disconnectedAfter )
494+ return fmt .Sprintf ("{agent=%s, replica=%s, disconnectedAt=%v,disconnectedNotBefore =%v}" ,
495+ m .agentID .String (),m .replicaID .String (),m .disconnectedAt ,m .disconnectedNotBefore )
496496}
497497
498498func (connectionUpdateMatcher )Got (x interface {})string {