Skip to content

Commit

Permalink
Revert change from Seq -> Sequence for ServerInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Jul 2, 2023
1 parent ef1794a commit f483cdc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions server/events.go
Expand Up @@ -210,8 +210,8 @@ type ServerInfo struct {
// Generic capability flags
Flags ServerCapability
// Sequence and Time from the remote server for this message.
Sequence uint64 `json:"seq"`
Time time.Time `json:"time"`
Seq uint64 `json:"seq"`
Time time.Time `json:"time"`
}

const (
Expand Down Expand Up @@ -432,7 +432,7 @@ RESET:
si.Host = host
si.Cluster = cluster
si.ID = id
si.Sequence = atomic.AddUint64(seqp, 1)
si.Seq = atomic.AddUint64(seqp, 1)
si.Version = VERSION
si.Time = time.Now().UTC()
si.Tags = tags
Expand Down Expand Up @@ -1470,15 +1470,15 @@ func (s *Server) remoteServerUpdate(sub *subscription, c *client, _ *Account, su
func (s *Server) updateRemoteServer(si *ServerInfo) {
su := s.sys.servers[si.ID]
if su == nil {
s.sys.servers[si.ID] = &serverUpdate{si.Sequence, time.Now()}
s.sys.servers[si.ID] = &serverUpdate{si.Seq, time.Now()}
s.processNewServer(si)
} else {
// Should always be going up.
if si.Sequence <= su.seq {
if si.Seq <= su.seq {
s.Errorf("Received out of order remote server update from: %q", si.ID)
return
}
su.seq = si.Sequence
su.seq = si.Seq
su.ltime = time.Now()
}
}
Expand Down
10 changes: 5 additions & 5 deletions server/events_test.go
Expand Up @@ -273,7 +273,7 @@ func TestSystemAccountNewConnection(t *testing.T) {
if cem.Server.ID != s.ID() {
t.Fatalf("Expected server to be %q, got %q", s.ID(), cem.Server.ID)
}
if cem.Server.Sequence == 0 {
if cem.Server.Seq == 0 {
t.Fatalf("Expected sequence to be non-zero")
}
if cem.Client.Name != "TEST EVENTS" {
Expand Down Expand Up @@ -348,10 +348,10 @@ func TestSystemAccountNewConnection(t *testing.T) {
if dem.Server.ID != s.ID() {
t.Fatalf("Expected server to be %q, got %q", s.ID(), dem.Server.ID)
}
if dem.Server.Sequence == 0 {
if dem.Server.Seq == 0 {
t.Fatalf("Expected sequence to be non-zero")
}
if dem.Server.Sequence <= cem.Server.Sequence {
if dem.Server.Seq <= cem.Server.Seq {
t.Fatalf("Expected sequence to be increasing")
}

Expand Down Expand Up @@ -1400,8 +1400,8 @@ func TestAccountReqInfo(t *testing.T) {
t.Fatalf("Unexpected value: %v", srv.Name)
} else if srv.Host != opts.Host {
t.Fatalf("Unexpected value: %v", srv.Host)
} else if srv.Sequence < 1 {
t.Fatalf("Unexpected value: %v", srv.Sequence)
} else if srv.Seq < 1 {
t.Fatalf("Unexpected value: %v", srv.Seq)
}
}
info := AccountInfo{}
Expand Down

0 comments on commit f483cdc

Please sign in to comment.