From 90650e4d8be8c0a964edda196cc196bb2a57e1c8 Mon Sep 17 00:00:00 2001 From: artin Date: Thu, 4 Dec 2025 01:56:31 +0800 Subject: [PATCH] ALIDNS: Update pagination functions to accept customizable page sizes --- providers/alidns/api.go | 4 ++-- providers/alidns/pagination.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/providers/alidns/api.go b/providers/alidns/api.go index 01388e950..d11a3403b 100644 --- a/providers/alidns/api.go +++ b/providers/alidns/api.go @@ -139,7 +139,7 @@ func (a *aliDnsDsp) describeDomainRecordsAll(domain string) ([]*alidns.Record, e return resp.DomainRecords.Record, total, nil } - vals, err := paginateAll(fetch) + vals, err := paginateAll(fetch, 500) if err != nil { return nil, err } @@ -171,5 +171,5 @@ func (a *aliDnsDsp) describeDomainsAll() ([]string, error) { return domains, total, nil } - return paginateAll(fetch) + return paginateAll(fetch, 100) } diff --git a/providers/alidns/pagination.go b/providers/alidns/pagination.go index 0224687f3..6eb46e162 100644 --- a/providers/alidns/pagination.go +++ b/providers/alidns/pagination.go @@ -5,8 +5,7 @@ package alidns // returns the items for that page, the total number of items available, // and an error if any. paginateAll will iterate pages until it has // collected all items or an error occurs. -func paginateAll[T any](fetch func(pageNumber, pageSize int) ([]T, int, error)) ([]T, error) { - const maxPageSize = 500 // Alibaba API max for many endpoints +func paginateAll[T any](fetch func(pageNumber, pageSize int) ([]T, int, error), maxPageSize int) ([]T, error) { page := 1 pageSize := maxPageSize var out []T