Skip to content

Commit

Permalink
Addressed PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
  • Loading branch information
GumpacG committed Jul 25, 2024
1 parent bce3c58 commit b41712a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3674,7 +3674,7 @@ export class BaseClient {
* @param keys - The keys of the sorted sets.
* @param modifier - The element pop criteria - either {@link ScoreFilter.MIN} or
* {@link ScoreFilter.MAX} to pop the member with the lowest/highest score accordingly.
* @param count - The number of elements to pop.
* @param count - (Optional) The number of elements to pop. If not supplied, only one element will be popped.
* @returns A two-element `array` containing the key name of the set from which the element
* was popped, and a member-score `Record` of the popped element.
* If no member could be popped, returns `null`.
Expand All @@ -3689,7 +3689,7 @@ export class BaseClient {
* // Output: [ "zSet1", { three: 3, two: 2 } ] - "three" with score 3 and "two" with score 2 were popped from "zSet1".
* ```
*/
public zmpop(
public async zmpop(
keys: string[],
modifier: ScoreFilter,
count?: number,
Expand All @@ -3706,14 +3706,14 @@ export class BaseClient {
*
* @remarks
* 1. When in cluster mode, all `keys` must map to the same hash slot.
* 2. `BZMPOP` is a client blocking command, see https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#blocking-commands
* 2. `BZMPOP` is a client blocking command, see {@link https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#blocking-commands | the wiki}
* for more details and best practices.
* @param keys - The keys of the sorted sets.
* @param modifier - The element pop criteria - either {@link ScoreFilter.MIN} or
* {@link ScoreFilter.MAX} to pop the member with the lowest/highest score accordingly.
* @param count - The number of elements to pop.
* @param timeout - The number of seconds to wait for a blocking operation to complete.
* A value of 0 will block indefinitely.
* @param count - (Optional) The number of elements to pop. If not supplied, only one element will be popped.
* @returns A two-element `array` containing the key name of the set from which the element
* was popped, and a member-score `Record` of the popped element.
* If no member could be popped, returns `null`.
Expand All @@ -3728,7 +3728,7 @@ export class BaseClient {
* // Output: [ "zSet1", { three: 3, two: 2 } ] - "three" with score 3 and "two" with score 2 were popped from "zSet1".
* ```
*/
public bzmpop(
public async bzmpop(
keys: string[],
modifier: ScoreFilter,
timeout: number,
Expand Down
6 changes: 4 additions & 2 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* @param keys - The keys of the sorted sets.
* @param modifier - The element pop criteria - either {@link ScoreFilter.MIN} or
* {@link ScoreFilter.MAX} to pop the member with the lowest/highest score accordingly.
* @param count - The number of elements to pop.
* @param count - (Optional) The number of elements to pop. If not supplied, only one element will be popped.
*
* Command Response - A two-element `array` containing the key name of the set from which the
* element was popped, and a member-score `Record` of the popped element.
Expand All @@ -2187,15 +2187,17 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Pops a member-score pair from the first non-empty sorted set, with the given `keys` being
* checked in the order they are provided. Blocks the connection when there are no members
* to pop from any of the given sorted sets. `BZMPOP` is the blocking variant of `ZMPOP`.
* `BZMPOP` is a client blocking command, see {@link https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#blocking-commands | the wiki}
* for more details and best practices.
*
* See https://valkey.io/commands/bzmpop/ for more details.
*
* @param keys - The keys of the sorted sets.
* @param modifier - The element pop criteria - either {@link ScoreFilter.MIN} or
* {@link ScoreFilter.MAX} to pop the member with the lowest/highest score accordingly.
* @param count - The number of elements to pop.
* @param timeout - The number of seconds to wait for a blocking operation to complete.
* A value of 0 will block indefinitely.
* @param count - (Optional) The number of elements to pop. If not supplied, only one element will be popped.
*
* Command Response - A two-element `array` containing the key name of the set from which the element
* was popped, and a member-score `Record` of the popped element.
Expand Down
5 changes: 5 additions & 0 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5055,6 +5055,11 @@ export function runBaseTests<Context>(config: {
client.bzmpop([key1], ScoreFilter.MAX, 0.1, 0),
).rejects.toThrow(RequestError);

// incorrect argument: timeout can not be a negative number
await expect(
client.bzmpop([key1], ScoreFilter.MAX, -1, 10),
).rejects.toThrow(RequestError);

// check that order of entries in the response is preserved
const entries: Record<string, number> = {};

Expand Down

0 comments on commit b41712a

Please sign in to comment.