[MM-49243] - Use paged requests to request the list of teams (#26278)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Elton Goh Jun Hao
2024-04-04 16:09:15 +08:00
коммит произвёл GitHub
родитель 087c993bed
Коммит 4bbcfd74ad
8 изменённых файлов: 38 добавлений и 11 удалений

Просмотреть файл

@@ -188,7 +188,9 @@ func createCommandCmdF(c client.Client, cmd *cobra.Command, args []string) error
func listCommandCmdF(c client.Client, cmd *cobra.Command, args []string) error {
var teams []*model.Team
if len(args) < 1 {
teamList, _, err := c.GetAllTeams(context.TODO(), "", 0, 10000)
teamList, err := getPages(func(page, numPerPage int, etag string) ([]*model.Team, *model.Response, error) {
return c.GetAllTeams(context.TODO(), etag, page, numPerPage)
}, DefaultPageSize)
if err != nil {
return err
}