Add a new way to query all users

Aberta
#151 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
api

Direção de pesquisa

Comece rastreando o ponto de entrada query_channels e o tratamento de offset e limit usado por stream-chat==4.8.0. Verifique as orientações vinculadas do Zendesk e reproduza o loop de paginação descrito na issue; done deve fornecer uma forma documentada de recuperar todos os usuários ou canais correspondentes além de offset 1000 sem entrar em loop indefinidamente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

https://support.getstream.io/hc/en-us/articles/4414446580119-Querying-for-users-channels-past-the-offset-1000-limit-Chat

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

Linguagem predominante
Python
Estrelas
73
Forks
20
Merge médio
11h 34min
PRs com merge (30d)
7

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de GetStream/stream-chat-python

Todas as issues de GetStream/stream-chat-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.