Skip to content

Commit

Permalink
More tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhuaaa committed Sep 17, 2024
1 parent 1b33be3 commit 0a6d801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions pkg/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ func (s *Service) BatchSubscribeEnvelopes(
req *message_api.BatchSubscribeEnvelopesRequest,
stream message_api.ReplicationApi_BatchSubscribeEnvelopesServer,
) error {
log := s.log.Named("subscribe") // .With(zap.Strings("content_topics", req.ContentTopics))
log.Debug("started")
defer log.Debug("stopped")
log := s.log.Named("subscribe")

// Send a header (any header) to fix an issue with Tonic based GRPC clients.
// See: https://github.com/xmtp/libxmtp/pull/58
Expand Down Expand Up @@ -122,6 +120,7 @@ func (s *Service) QueryEnvelopes(
ctx context.Context,
req *message_api.QueryEnvelopesRequest,
) (*message_api.QueryEnvelopesResponse, error) {
log := s.log.Named("query")
params, err := s.queryReqToDBParams(req)
if err != nil {
return nil, err
Expand All @@ -138,7 +137,7 @@ func (s *Service) QueryEnvelopes(
err := proto.Unmarshal(row.OriginatorEnvelope, originatorEnv)
if err != nil {
// We expect to have already validated the envelope when it was inserted
s.log.Error("could not unmarshal originator envelope", zap.Error(err))
log.Error("could not unmarshal originator envelope", zap.Error(err))
continue
}
envs = append(envs, originatorEnv)
Expand All @@ -152,7 +151,6 @@ func (s *Service) QueryEnvelopes(
func (s *Service) queryReqToDBParams(
req *message_api.QueryEnvelopesRequest,
) (*queries.SelectGatewayEnvelopesParams, error) {
// TODO(rich) named logs
params := queries.SelectGatewayEnvelopesParams{
Topic: nil,
OriginatorNodeID: sql.NullInt32{},
Expand Down
1 change: 0 additions & 1 deletion pkg/api/subscribeWorker.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func (s *subscribeWorker) start() {
case <-s.ctx.Done():
return
case new_batch := <-s.dbSubscription:
// Log batch size, performance
for _, row := range new_batch {
s.dispatch(&row)
}
Expand Down

0 comments on commit 0a6d801

Please sign in to comment.