Skip to content

Commit

Permalink
[FIXED] Default statistics handler of microservice had unnecessary ch…
Browse files Browse the repository at this point in the history
…eck (#837)

The default handler was invoked with a request that was already
checked to have a service associated. The handler was extracting
the service (that was not needed) and had an incorrect check
such as `if ((m == NULL) || (m == NULL))`.

Resolves #833

Signed-off-by: Ivan Kozlovic <[email protected]>
  • Loading branch information
kozlovic authored Feb 16, 2025
1 parent 7220e9f commit 6d6590b
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/micro_monitoring.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,9 @@ static microError *
handle_stats_default(microRequest *req)
{
microError *err = NULL;
microService *m = microRequest_GetService(req);
microServiceStats *stats = NULL;
natsBuffer *buf = NULL;

if ((m == NULL) || (m == NULL))
return micro_ErrorInvalidArg; // Should not happen

MICRO_CALL(err, microService_GetStats(&stats, req->Service));
MICRO_CALL(err, marshal_stats(&buf, stats));
MICRO_CALL(err, microRequest_Respond(req, natsBuf_Data(buf), natsBuf_Len(buf)));
Expand Down

0 comments on commit 6d6590b

Please sign in to comment.