[ServiceBus] don't yield empty page when listing rules in RuleManager (#22159)
We should stop when there's no more returned rules. I did this previously probably to support continuationToken as we have to make the last request to know that there are no more results, and we then set continuationToken to undefined on this empty page. Now that the continuationToken is removed, we can stop yielding empty page.
This commit is contained in:
Родитель
d6c33967b1
Коммит
79bb5b3bc7
|
@ -10,6 +10,8 @@
|
|||
|
||||
### Other Changes
|
||||
|
||||
- Stop yielding empty page when listing rules using RuleManager.
|
||||
|
||||
## 7.6.0-beta.4 (2022-06-07)
|
||||
|
||||
### Features Added
|
||||
|
|
|
@ -193,8 +193,8 @@ export class ServiceBusRuleManagerImpl implements ServiceBusRuleManager {
|
|||
maxCount: options.maxPageSize ?? 100,
|
||||
...options,
|
||||
});
|
||||
yield rules;
|
||||
if (rules.length > 0) {
|
||||
yield rules;
|
||||
marker = String(Number(marker ?? 0) + rules.length);
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -232,8 +232,6 @@ describe("RuleManager tests", () => {
|
|||
assert.equal(result.value.length, 1, "Expecting one rule in third page");
|
||||
assert.equal(result.value[0].name, sqlRuleName);
|
||||
result = await iterator.next();
|
||||
assert.equal(result.value.length, 0, "Not expecting any result in last page");
|
||||
result = await iterator.next();
|
||||
assert.equal(result.value, undefined, "Not expecting any more pages");
|
||||
});
|
||||
|
||||
|
@ -274,8 +272,6 @@ describe("RuleManager tests", () => {
|
|||
let result = await iterator.next();
|
||||
assert.equal(result.value.length, 3, "Expecting one rule in first page");
|
||||
result = await iterator.next();
|
||||
assert.equal(result.value.length, 0, "Not expecting any result in last page");
|
||||
result = await iterator.next();
|
||||
assert.equal(result.value, undefined, "Not expecting any more pages");
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче