Skip to content

Commit

Permalink
Implement XGROUP DELCONSUMER, XGROUP CREATECONSUMER, and `XINFO C…
Browse files Browse the repository at this point in the history
…ONSUMERS`

Fix #162
Fix #163
Fix #167
  • Loading branch information
cunla committed Jun 11, 2023
1 parent fb03707 commit 0037612
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
24 changes: 12 additions & 12 deletions docs/redis-commands/Redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,14 @@ Returns the number of messages after removing them from a stream.

Creates a consumer group.

### [XGROUP CREATECONSUMER](https://redis.io/commands/xgroup-createconsumer/)

Creates a consumer in a consumer group.

### [XGROUP DELCONSUMER](https://redis.io/commands/xgroup-delconsumer/)

Deletes a consumer from a consumer group.

### [XGROUP DESTROY](https://redis.io/commands/xgroup-destroy/)

Destroys a consumer group.
Expand All @@ -1490,6 +1498,10 @@ Destroys a consumer group.

Sets the last-delivered ID of a consumer group.

### [XINFO CONSUMERS](https://redis.io/commands/xinfo-consumers/)

Returns a list of the consumers in a consumer group.

### [XINFO GROUPS](https://redis.io/commands/xinfo-groups/)

Returns a list of the consumer groups of a stream.
Expand Down Expand Up @@ -1534,14 +1546,6 @@ Changes, or acquires, ownership of a message in a consumer group, as if the mess

A container for consumer groups commands.

#### [XGROUP CREATECONSUMER](https://redis.io/commands/xgroup-createconsumer/) <small>(not implemented)</small>

Creates a consumer in a consumer group.

#### [XGROUP DELCONSUMER](https://redis.io/commands/xgroup-delconsumer/) <small>(not implemented)</small>

Deletes a consumer from a consumer group.

#### [XGROUP HELP](https://redis.io/commands/xgroup-help/) <small>(not implemented)</small>

Returns helpful text about the different subcommands.
Expand All @@ -1550,10 +1554,6 @@ Returns helpful text about the different subcommands.

A container for stream introspection commands.

#### [XINFO CONSUMERS](https://redis.io/commands/xinfo-consumers/) <small>(not implemented)</small>

Returns a list of the consumers in a consumer group.

#### [XINFO HELP](https://redis.io/commands/xinfo-help/) <small>(not implemented)</small>

Returns helpful text about the different subcommands.
Expand Down
3 changes: 2 additions & 1 deletion fakeredis/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def format_record(self):
return [self.key.encode(), results]


current_time = lambda: int(time.time() * 1000)
def current_time():
return int(time.time() * 1000)


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions test/test_mixins/test_streams_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def test_xgroup_destroy(r: redis.Redis):


@pytest.mark.max_server('6.3')
def test_xgroup_setid_redis6(r: redis.Redis):
def test_xgroup_create_redis6(r: redis.Redis):
stream, group = "stream", "group"
message_id = r.xadd(stream, {"foo": "bar"})
r.xgroup_create(stream, group, message_id)
Expand All @@ -310,7 +310,7 @@ def test_xgroup_setid_redis6(r: redis.Redis):


@pytest.mark.min_server('7')
def test_xgroup_setid_redis7(r: redis.Redis):
def test_xgroup_create_redis7(r: redis.Redis):
stream, group = "stream", "group"
message_id = r.xadd(stream, {"foo": "bar"})
r.xgroup_create(stream, group, message_id)
Expand Down

0 comments on commit 0037612

Please sign in to comment.