Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADDED, BREAKING] Services: queue group now configurable and can be disabled #800

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

levb
Copy link
Collaborator

@levb levb commented Sep 23, 2024

Compliance with nats-io/nats-architecture-and-design#239 and nats-io/nats-architecture-and-design#300

One can now customize the queue group used for microservice endpoints, or disable its use.

@levb levb requested review from mtmk, Jarema and kozlovic September 23, 2024 21:00
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 32 lines in your changes missing coverage. Please review.

Project coverage is 70.55%. Comparing base (1553d4a) to head (4fdf2a0).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/micro.c 65.27% 8 Missing and 17 partials ⚠️
src/micro_endpoint.c 62.50% 1 Missing and 5 partials ⚠️
src/micro_monitoring.c 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #800      +/-   ##
==========================================
+ Coverage   68.71%   70.55%   +1.83%     
==========================================
  Files          39       47       +8     
  Lines       15207    15450     +243     
  Branches     3143     3181      +38     
==========================================
+ Hits        10449    10900     +451     
+ Misses       1700     1476     -224     
- Partials     3058     3074      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@levb levb marked this pull request as draft September 23, 2024 21:10
@levb
Copy link
Collaborator Author

levb commented Sep 23, 2024

Looking into the test failure, please hold off the review.

It appears possible that the client exits before the (own) dispatcher
thread finishes and quits. Waiting until the "Done" callback is invoked
fixes it.

Also, since a sub is (often? always?) freed from the own dispatcher thread,
use natsThread_Detach rather than natsThread_Join when cleaning up own
dispatcher.
@levb levb marked this pull request as ready for review September 25, 2024 01:11
{
nats_destroyQueuedMessages(&sub->ownDispatcher.queue);

if (sub->ownDispatcher.thread != NULL)
{
natsThread_Join(sub->ownDispatcher.thread);
natsThread_Detach(sub->ownDispatcher.thread);
Copy link
Collaborator Author

@levb levb Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kozlovic this was an oversight on my end in a prior commit, I think. This code can be executed in the dispatch thread itself, so "Join" wouldn't be right. Anyway, this restores the original logic. It did not appear to affect the test failure here, the wait in the test did.

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little changes, but otherwise LGTM.

src/nats.h Outdated Show resolved Hide resolved
src/nats.h Outdated Show resolved Hide resolved
src/nats.h Outdated Show resolved Hide resolved
src/nats.h Outdated Show resolved Hide resolved
src/nats.h Outdated Show resolved Hide resolved
test/test.c Show resolved Hide resolved
test/test.c Show resolved Hide resolved
test/test.c Show resolved Hide resolved
@levb levb requested a review from kozlovic September 25, 2024 18:44
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@levb levb merged commit 87d7472 into main Sep 25, 2024
30 checks passed
@levb levb deleted the lev-211-services-no-queue-group branch September 25, 2024 19:04
github-actions bot pushed a commit that referenced this pull request Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants