slackapi / slackapi/python-slack-sdk

API Cursor Pagination Performance : conversations.list

Abierto
#1,494 3 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

auto-triage-skip server-side-issue Version: 3x web-client
Lenguaje dominante
Python
Estrellas
4k
Forks
857
Merge medio
22 h 21 min
PR fusionados (30 d)
16

Descripción

The behavior characteristics and performance of iterating the cursor through conversations.list is truly awful when it is being used to resolve a channel name to a channel id.

For example, if I create a new channel in an org that's been around for a while, with limit=200, that channel is returned on page 135, and the pagination sequence takes 7m38.503s to resolve with 20 calls per minute (tier 2 rate limit).
When inspecting the responses, it can be seen that the channels returned never reach the limit count, and progressively diminish, eventually returning no results across cursors, sometimes 2, sometimes 10, etc., until finally resolving.

Please, either create a new class of methods that support resolving user or channel names directly to their IDs, or optimize the data that feeds the pagination to enable the methods to return valuable data earlier in the pagination sequence.

This is related to the last bullet under Just The Facts:

It's possible to receive fewer results than your specified limit, even when there are additional results to retrieve.

Note
This started when looking at chat.update and seeing that it required a channel id rather than a channel name (I tested it and it's not just a docs issue...). Rather than fixing the above situation, if you can align the chat.postMessage and chat.update methods to both accept a channel name, then that would satisfy my original problem. Though, the above deficiency will still exist. I've made a separate issue for this here.

Category (place an x in each of the [ ])
  • [X ] slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.models (UI component builders)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.rtm (RTM client)
  • slack_sdk.signature (Request Signature Verifier)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con los puntos de entrada de slack_sdk.web.WebClient para conversations.list, chat.update y chat.postMessage, y luego inspecciona cómo se exponen la paginación mediante cursor y el manejo de nombres de canales. El issue presenta varias soluciones posibles, por lo que, para darlo por terminado, hay que elegir y especificar si el SDK debe resolver los nombres directamente, optimizar la paginación o alinear los métodos de mensajes, con pruebas que cubran el comportamiento seleccionado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend-api-design
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.