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] kvStore_WatchMulti, js_Subscribe[Sync]Multi #750

Merged
merged 18 commits into from May 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/js.c
Expand Up @@ -2224,8 +2224,8 @@
}
if ((numSubjects == 1) && nats_IsStringEmpty(subjects[0]))
{
subjects = NULL;
numSubjects = 0;

Check warning on line 2228 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2227-L2228

Added lines #L2227 - L2228 were not covered by tests
}

// Match the subjects against the consumer's filter subjects.
Expand Down Expand Up @@ -2603,7 +2603,7 @@
int l = nats_printStringArray(NULL, 0, subjects, numSubjects);
levb marked this conversation as resolved.
Show resolved Hide resolved
jsi->psubj = NATS_CALLOC(l, 1); // '\0' included
if (jsi->psubj == NULL)
s = nats_setDefaultError(NATS_NO_MEMORY);

Check warning on line 2606 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2606

Added line #L2606 was not covered by tests
if (s == NATS_OK)
nats_printStringArray(jsi->psubj, l, subjects, numSubjects);
}
Expand Down Expand Up @@ -2764,12 +2764,12 @@
natsMsgHandler usrCB, void *usrCBClosure, bool isPullMode,
jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode)
{
natsStatus s = NATS_OK;
const char *subjects[] = {subject};
int numSubjects = nats_IsStringEmpty(subject) ? 0 : 1;

if (nats_IsStringEmpty(subject))
return _subscribeMulti(new_sub, js, NULL, 0, pullDurable, usrCB, usrCBClosure, isPullMode, jsOpts, opts, errCode);

return _subscribeMulti(new_sub, js, subjects, 1, pullDurable, usrCB, usrCBClosure, isPullMode, jsOpts, opts, errCode);
s = _subscribeMulti(new_sub, js, subjects, numSubjects, pullDurable, usrCB, usrCBClosure, isPullMode, jsOpts, opts, errCode);
levb marked this conversation as resolved.
Show resolved Hide resolved
return NATS_UPDATE_ERR_STACK(s);
}

natsStatus
Expand All @@ -2790,20 +2790,20 @@
}

natsStatus
js_SubscribeMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,

Check warning on line 2793 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2793

Added line #L2793 was not covered by tests
natsMsgHandler cb, void *cbClosure,
jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode)
{
natsStatus s;

if (errCode != NULL)
*errCode = 0;

Check warning on line 2800 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2800

Added line #L2800 was not covered by tests

if (cb == NULL)
return nats_setDefaultError(NATS_INVALID_ARG);

Check warning on line 2803 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2803

Added line #L2803 was not covered by tests

s = _subscribeMulti(sub, js, subjects, numSubjects, NULL, cb, cbClosure, false, jsOpts, opts, errCode);
return NATS_UPDATE_ERR_STACK(s);

Check warning on line 2806 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2805-L2806

Added lines #L2805 - L2806 were not covered by tests
}

natsStatus
Expand All @@ -2829,7 +2829,7 @@
*errCode = 0;

s = _subscribeMulti(sub, js, subjects, numSubjects, NULL, NULL, NULL, false, jsOpts, opts, errCode);
return NATS_UPDATE_ERR_STACK(s);

Check warning on line 2832 in src/js.c

View check run for this annotation

Codecov / codecov/patch

src/js.c#L2832

Added line #L2832 was not covered by tests
}

natsStatus
Expand Down