Skip to content

Commit

Permalink
log the fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Mar 26, 2024
1 parent 0093993 commit 43f8dd6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

const enterpriseIsRestricted = "enterprise_is_restricted"

//go:generate stringer -type=fallbackMethod -trimprefix=fb
type fallbackMethod int

const (
Expand Down Expand Up @@ -66,6 +67,7 @@ func (fc *fallbackClient) fallback(m fallbackMethod) error {
return errNoMoreFallback
}
fc.methodPtr[m]++
fc.lg.Printf("falling back on %s, %d -> %d", m, ptr-1, ptr)
return nil
}

Expand All @@ -76,6 +78,7 @@ func (fc *fallbackClient) getClient(m fallbackMethod) (clienter, error) {
if ptr >= len(fc.cl) {
return nil, errNoMoreFallback
}
fc.lg.Debugf("current method %s[%d]", m, ptr)
return fc.cl[ptr], nil
}

Expand Down
34 changes: 34 additions & 0 deletions fallbackmethod_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43f8dd6

Please sign in to comment.