Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beetle go client: reduce lines logged by a factor of 10 #74

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type RedisSystem struct {
client *ClientState
}

const RECONFIGURE_LOG_INTERVAL = 10

// ClientState holds the client state.
type ClientState struct {
opts *ClientOptions
Expand All @@ -39,6 +41,7 @@ type ClientState struct {
readerDone chan struct{}
configChanges chan consul.Env
redisSystems map[string]*RedisSystem
ticks uint64
}

// GetConfig returns the client configuration in a thread safe way.
Expand Down Expand Up @@ -116,7 +119,7 @@ func (s *ClientState) SendHeartBeat() error {
return s.send(MsgBody{Name: HEARTBEAT, Id: s.opts.Id})
}

// Ping sends a PING message to the server.
// Ping sends a PONG message to the server.
func (s *ClientState) Ping(pingMsg MsgBody) error {
logInfo("Received ping message")
rs := s.RegisterSystem(pingMsg.System)
Expand Down Expand Up @@ -227,7 +230,10 @@ func (s *ClientState) Invalidate(msg MsgBody) error {
// Reconfigure updates the redis mater file on disk, provided the token sent
// with the message is valid.
func (s *ClientState) Reconfigure(msg MsgBody) error {
logInfo("Received reconfigure message with server '%s' and token '%s'", msg.Server, msg.Token)
if s.ticks%RECONFIGURE_LOG_INTERVAL == 0 {
logInfo("Received reconfigure message with server '%s' and token '%s'", msg.Server, msg.Token)
}
s.ticks++
rs := s.RegisterSystem(msg.System)
if !rs.RedeemToken(msg.Token) {
logInfo("Received invalid or outdated token: '%s'", msg.Token)
Expand Down