Skip to content

Commit

Permalink
logmsg adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
gertd committed May 16, 2024
1 parent 06da8cc commit d311afe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/datasync/datasync.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (c *Client) Sync(ctx context.Context, conn *grpc.ClientConn, opts ...Option
const (
syncScheduler string = "scheduler"
syncOnDemand string = "on-demand"
syncTask string = "sync-task"
syncRun string = "sync-run"
syncProducer string = "producer"
syncSubscriber string = "subscriber"
syncDifference string = "difference"
syncManifest string = "manifest"
status string = "status"
started string = "started"
stage string = "stage"
Expand Down
9 changes: 8 additions & 1 deletion pkg/datasync/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"hash/fnv"
"io"
"strconv"
"time"

"github.com/aserto-dev/azm/model"
manifest "github.com/aserto-dev/azm/v3"
Expand All @@ -22,6 +23,9 @@ import (
)

func (s *Sync) syncManifest(ctx context.Context, conn *grpc.ClientConn) error {
runStartTime := time.Now().UTC()
s.logger.Info().Str(status, started).Str("mode", s.options.Mode.String()).Msg(syncManifest)

ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down Expand Up @@ -58,7 +62,7 @@ func (s *Sync) syncManifest(ctx context.Context, conn *grpc.ClientConn) error {
return err
}

s.logger.Info().Str("local.etag", localMD.Etag).Str("remote.etag", remoteMD.Etag).Bool("identical", localMD.Etag == remoteMD.Etag).Msg("datasync.sync.manifest")
s.logger.Debug().Str("local.etag", localMD.Etag).Str("remote.etag", remoteMD.Etag).Bool("identical", localMD.Etag == remoteMD.Etag).Msg(syncManifest)
if localMD.Etag == remoteMD.Etag {
return nil
}
Expand All @@ -68,6 +72,9 @@ func (s *Sync) syncManifest(ctx context.Context, conn *grpc.ClientConn) error {
return err
}

runEndTime := time.Now().UTC()
s.logger.Info().Str(status, finished).Str("duration", runEndTime.Sub(runStartTime).String()).Msg(syncManifest)

return s.store.MC().UpdateModel(m)
}

Expand Down

0 comments on commit d311afe

Please sign in to comment.