Reorder logging statement
@@ -66,6 +66,9 @@ func (a *apiServer) CreateStream(ctx context.Context, req *client.CreateStreamRe
// messages when it reaches the end of the partition. Use the request context
// to close the subscription.
func (a *apiServer) Subscribe(req *client.SubscribeRequest, out client.API_SubscribeServer) error {
+ a.logger.Debugf("api: Subscribe [stream=%s, partition=%d, start=%s, offset=%d, timestamp=%d]",
+ req.Stream, req.Partition, req.StartPosition, req.StartOffset, req.StartTimestamp)
+
partition := a.metadata.GetPartition(req.Stream, req.Partition)
if partition == nil {
a.logger.Errorf("api: Failed to subscribe to partition "+
@@ -74,9 +77,6 @@ func (a *apiServer) Subscribe(req *client.SubscribeRequest, out client.API_Subsc
return status.Error(codes.NotFound, "No such partition")
}
- a.logger.Debugf("api: Subscribe [stream=%s, partition=%d, start=%s, offset=%d, timestamp=%d]",
- req.Stream, req.Partition, req.StartPosition, req.StartOffset, req.StartTimestamp)
-
leader, _ := partition.GetLeader()
if leader != a.config.Clustering.ServerID {
a.logger.Errorf("api: Failed to subscribe to partition %s: server not stream leader", partition)
