Skip to content

Commit

Permalink
fix local tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bubbajoe committed May 24, 2024
1 parent 2112797 commit 1896342
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions internal/proxy/proxystore/proxy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func (store *ProxyStore) FetchChangeLogs() ([]*spec.ChangeLog, error) {
if len(clBytes) == 0 {
return nil, nil
}
store.logger.Debug("found %d changelog entries", len(clBytes))
store.logger.Debug("found changelog entries", "numBytes", len(clBytes))
logs := make([]*spec.ChangeLog, len(clBytes))
for i, clKv := range clBytes {
var clObj spec.ChangeLog
err = json.Unmarshal(clKv.Value, &clObj)
if err != nil {
store.logger.Debug("failed to unmarshal changelog entry: %s", err.Error())
store.logger.Debug("failed to unmarshal changelog entry", "error", err.Error())
return nil, errors.New("failed to unmarshal changelog entry: " + err.Error())
}
logs[i] = &clObj
Expand All @@ -63,14 +63,13 @@ func (store *ProxyStore) StoreChangeLog(cl *spec.ChangeLog) error {
if err != nil {
return err
}
store.logger.Debug("storing changelog:%s", string(clBytes))
retries, delay := 30, time.Microsecond*100
RETRY:
err = store.storage.Set("changelog/"+cl.ID, clBytes)
if err != nil {
if retries > 0 {
store.logger.With("error", err).
Error("failed to store changelog, retrying %d more times", retries)
Error("failed to store changelog", "retries", retries)
time.Sleep(delay)
retries--
goto RETRY
Expand Down Expand Up @@ -143,7 +142,7 @@ func (store *ProxyStore) StoreDocument(doc *spec.Document) error {
if err != nil {
return err
}
store.logger.Debug("storing document: %s", string(docBytes))
store.logger.Debug("storing document")
err = store.storage.Set(createDocumentKey(doc.NamespaceName, doc.CollectionName, doc.ID), docBytes)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/raftadmin/raftadmin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestRaft(t *testing.T) {
client := NewHTTPAdminClient(
server.Client().Do,
"http://(address)/raftadmin",
slog.New(nil),
slog.Default(),
)
serverAddr := raft.ServerAddress(server.Listener.Addr().String())
leader, err := client.Leader(ctx, serverAddr)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/logger/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (l *SLogHCAdapter) ResetNamed(name string) hclog.Logger {
}

func (l *SLogHCAdapter) With(args ...any) hclog.Logger {
return &SLogHCAdapter{l.ctx, l.logger.With(args), l.level}
return &SLogHCAdapter{l.ctx, l.logger.With(), l.level}
}

func (l *SLogHCAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger {
Expand Down

0 comments on commit 1896342

Please sign in to comment.