Add a new way to query all users
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by tracing the query_channels entry point and the offset and limit handling used by stream-chat==4.8.0. Check the linked Zendesk guidance and reproduce the pagination loop described in the issue; done should provide a documented way to retrieve all matching users or channels beyond offset 1000 without looping indefinitely.
Written by the indexing model from the issue text.
Description
Problem explanation
Zendesk ticket: 43044
query_channels possible infinite loop by always returning results over 1000
eg Asking for offset: 1000000 will return users even when only 2000 users may exist in the system.
I would suggest that the library implement an easy way to query all users with offsets greater than 1000, maybe a python iterable.
Steps to reproduce
I'm well aware this code is not very clean but it does show the issue. Since query channels will always return items in the array you don't know when to stop.
channels = []
offset = 0
limit = max_limit_to_fetch_channels
channels_fetched_count = limit
while channels_fetched_count > 0 or channels_fetched_count == limit:
channels_fetched = query_channels(
filter_conditions=......,
sort={"last_message_at": -1},
message_limit=1,
channel_limit=limit,
offset=offset,
)
channels.extend(channels_fetched)
offset += limit
channels_fetched_count = len(channels_fetched)
Environment info
Library version: stream-chat==4.8.0
- Dominant language
- Python
- Stars
- 73
- Forks
- 20
- Avg merge
- 11h 34m
- Merged PRs (30d)
- 7
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/stream-chat-python
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/stream-chat-python#252 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
GetStream/stream-chat-python#244 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
GetStream/stream-chat-python#167 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
GetStream/stream-chat-python#166 · 2 comments ·
-
conda?Open
Difficulty 5/5 Over a week Newbie friendliness 15/100
GetStream/stream-chat-python#152 ·
All issues in GetStream/stream-chat-python
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
NatLabRockies/openstudio-mcp#286 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
intersystems/ipm#1338 ·
Maintainers usually reply within 1 day
-
separate_packages splits imports from the same explicitly configured packagePossibly taken @rahul05ranjan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
The v0-through-v1 path derives ShutdownDuration its own way, silently overriding a user's definitionOpenv1
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day