Skip to content

Commit

Permalink
TRY MORE, +13
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Nov 3, 2024
1 parent 1fcbe70 commit 7fe1a46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ _detach_service_from_connection(natsConnection *nc, microService *m)
if (nc == NULL || m == NULL)
return false;

printf("<>/<> _detachING_service_from_connection %s\n", m->cfg->Name);
printf("<>/<> _detachING_service_from_connection %s\n", m->cfg->Name); fflush(stdout);
natsConn_Lock(nc);
for (int i = 0; i < nc->numServices; i++)
{
Expand All @@ -303,7 +303,7 @@ _detach_service_from_connection(natsConnection *nc, microService *m)
}
remaining = nc->numServices;
natsConn_Unlock(nc);
printf("<>/<> _detachED_service_from_connection %s: remaining: %d, removed: %d\n", m->cfg->Name, remaining, removed);
printf("<>/<> _detachED_service_from_connection %s: remaining: %d, removed: %d\n", m->cfg->Name, remaining, removed); fflush(stdout);
return removed;
}

Expand All @@ -324,7 +324,7 @@ _stop_service(microService *m, bool detachFromConnection, bool unsubscribe, bool
detached = _detach_service_from_connection(m->nc, m);

_lock_service(m);
printf("<>/<> _stop_service: %s: 1\n", m->cfg->Name);
printf("<>/<> _stop_service: %s, detached: %d\n", m->cfg->Name, detached); fflush(stdout);
if (!m->stopped)
m->stopped = true;
else
Expand All @@ -350,9 +350,10 @@ _stop_service(microService *m, bool detachFromConnection, bool unsubscribe, bool
m->refs--;
refs = m->refs;
numEndpoints = m->numEndpoints;
printf("<>/<> _stop_service: %s: 2: refs: %d, numEndpoints: %d\n", m->cfg->Name, refs, numEndpoints);
_unlock_service(m);

printf("<>/<> _stoppED_service: %s: refs: %d, numEndpoints: %d\n", m->cfg->Name, refs, numEndpoints); fflush(stdout);

if ((refs == 0) && (numEndpoints == 0))
_free_service(m);

Expand All @@ -362,7 +363,6 @@ _stop_service(microService *m, bool detachFromConnection, bool unsubscribe, bool
microError *
microService_Stop(microService *m)

Check warning on line 364 in src/micro.c

View check run for this annotation

Codecov / codecov/patch

src/micro.c#L364

Added line #L364 was not covered by tests
{
printf("<>/<> Stopping service %s from microService_Stop\n", m->cfg->Name);
return _stop_service(m, false, true, false);

Check warning on line 366 in src/micro.c

View check run for this annotation

Codecov / codecov/patch

src/micro.c#L366

Added line #L366 was not covered by tests
}

Expand Down Expand Up @@ -435,7 +435,7 @@ void micro_release_endpoint_when_unsubscribed(void *closure)

// Stop the service now in case it hasn't already and detach from the
// connection, no need to unsubscribe.
printf("<>/<> Stopping service %s from micro_release_endpoint_when_unsubscribed\n", m->cfg->Name);
printf("<>/<> Stopping service %s from micro_release_endpoint_when_unsubscribed\n", m->cfg->Name); fflush(stdout);
_stop_service(m, true, false, false);
}
}
Expand All @@ -457,7 +457,7 @@ bool microService_IsStopped(microService *m)
microError *
microService_Destroy(microService *m)
{
printf("<>/<> Stopping service %s from microService_Destroy\n", m->cfg->Name);
printf("<>/<> Stopping service %s from microService_Destroy\n", m->cfg->Name); fflush(stdout);
return _stop_service(m, false, true, true);
}

Expand Down Expand Up @@ -526,7 +526,7 @@ _free_service(microService *m)
if (m == NULL)
return;

printf("<>/<> Freeing service %s\n", m->cfg->Name);
printf("<>/<> Freeing service %s\n", m->cfg->Name); fflush(stdout);

// destroy all groups.
if (m->groups != NULL)
Expand Down Expand Up @@ -610,7 +610,7 @@ _on_connection_closed(natsConnection *nc, void *ignored)
natsConn_Lock(nc);
for (int i = 0; i < nc->numServices; i++)
{
printf("<>/<> Stopping service %s from on_connection_closed\n", nc->services[i]->cfg->Name);
printf("<>/<> Stopping service %s from on_connection_closed\n", nc->services[i]->cfg->Name); fflush(stdout);
_stop_service(nc->services[i], false, false, false);

Check warning on line 614 in src/micro.c

View check run for this annotation

Codecov / codecov/patch

src/micro.c#L613-L614

Added lines #L613 - L614 were not covered by tests
}
natsConn_Unlock(nc);
Expand Down Expand Up @@ -677,7 +677,7 @@ _on_error(natsConnection *nc, natsSubscription *sub, natsStatus s, void *not_use

// Stop the service in error. It will get detached from the connection
// and released when all of its subs are complete.
printf("<>/<> Stopping service %s from on_error\n", m->cfg->Name);
printf("<>/<> Stopping service %s from on_error\n", m->cfg->Name); fflush(stdout);
_stop_service(m, false, true, false);

Check warning on line 681 in src/micro.c

View check run for this annotation

Codecov / codecov/patch

src/micro.c#L680-L681

Added lines #L680 - L681 were not covered by tests
}
natsConn_Unlock(nc);

Check warning on line 683 in src/micro.c

View check run for this annotation

Codecov / codecov/patch

src/micro.c#L683

Added line #L683 was not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/micro_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ micro_stop_endpoint(microEndpoint *ep)
return NULL;

micro_lock_endpoint(ep);
printf("<>/<> Stopping endpoint %s %s\n", ep->m->cfg->Name, ep->subject);
printf("<>/<> Stopping endpoint %s %s\n", ep->m->cfg->Name, ep->subject); fflush(stdout);
sub = ep->sub;
micro_unlock_endpoint(ep);
if (sub == NULL)
Expand Down

0 comments on commit 7fe1a46

Please sign in to comment.