Skip to content

Commit

Permalink
fix: propagate set options to LeaseManager (from #1880) (#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
feywind authored Aug 26, 2024
1 parent f082869 commit cdb0916
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,16 @@ export class Subscriber extends EventEmitter {

const {maxStreams = defaultOptions.subscription.maxStreams} =
options.streamingOptions;

options.streamingOptions.maxStreams = Math.min(
maxStreams,
this.maxMessages
);
}

if (this._inventory) {
this._inventory.setOptions(this._options.flowControl!);
}
}

/**
Expand Down
4 changes: 4 additions & 0 deletions test/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class FakeLeaseManager extends EventEmitter {
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
add(message: s.Message): void {}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setOptions(options: FlowControlOptions): void {}
clear(): s.Message[] {
return [];
}
Expand All @@ -115,6 +117,8 @@ class FakeQueue {
async add(message: s.Message, deadline?: number): Promise<s.AckResponse> {
return s.AckResponses.Success;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setOptions(options: BatchOptions) {}
async flush(): Promise<void> {}
async onFlush(): Promise<void> {}
async onDrain(): Promise<void> {}
Expand Down

0 comments on commit cdb0916

Please sign in to comment.