@@ -223,13 +223,27 @@ func (c *FeatureStoreClient) LoadProjectData() error {
223223 }
224224 projectData := make (map [string ]* domain.Project , 0 )
225225
226- listProjectsResponse , err := c .client .FsProjectApi .ListProjects ()
227- if err != nil {
228- c .logError (fmt .Errorf ("list projects error, err=%v" , err ))
229- return err
226+ var (
227+ pagesize = 100
228+ pagenumber = 1
229+ )
230+ projects := make ([]* api.Project , 0 )
231+ for {
232+ listProjectsResponse , err := c .client .FsProjectApi .ListProjects (int32 (pagesize ), int32 (pagenumber ))
233+ if err != nil {
234+ c .logError (fmt .Errorf ("list projects error, err=%v" , err ))
235+ return err
236+ }
237+ projects = append (projects , listProjectsResponse .Projects ... )
238+
239+ if len (listProjectsResponse .Projects ) == 0 || pagesize * pagenumber > listProjectsResponse .TotalCount {
240+ break
241+ }
242+
243+ pagenumber ++
230244 }
231245
232- for _ , p := range listProjectsResponse . Projects {
246+ for _ , p := range projects {
233247 if p .ProjectName != c .client .GetConfig ().ProjectName {
234248 continue
235249 }
@@ -269,10 +283,7 @@ func (c *FeatureStoreClient) LoadProjectData() error {
269283 project .SetApiClient (c .client )
270284 projectData [project .ProjectName ] = project
271285
272- var (
273- pagesize = 100
274- pagenumber = 1
275- )
286+ pagenumber = 1
276287
277288 // get feature entities
278289 for {
@@ -385,13 +396,27 @@ func (c *FeatureStoreClient) lazyLoadProjectData() error {
385396 }
386397 projectData := make (map [string ]* domain.Project , 0 )
387398
388- listProjectsResponse , err := c .client .FsProjectApi .ListProjects ()
389- if err != nil {
390- c .logError (fmt .Errorf ("list projects error, err=%v" , err ))
391- return err
399+ var (
400+ pagesize = 100
401+ pagenumber = 1
402+ )
403+ projects := make ([]* api.Project , 0 )
404+ for {
405+ listProjectsResponse , err := c .client .FsProjectApi .ListProjects (int32 (pagesize ), int32 (pagenumber ))
406+ if err != nil {
407+ c .logError (fmt .Errorf ("list projects error, err=%v" , err ))
408+ return err
409+ }
410+ projects = append (projects , listProjectsResponse .Projects ... )
411+
412+ if len (listProjectsResponse .Projects ) == 0 || pagesize * pagenumber > listProjectsResponse .TotalCount {
413+ break
414+ }
415+
416+ pagenumber ++
392417 }
393418
394- for _ , p := range listProjectsResponse . Projects {
419+ for _ , p := range projects {
395420 if p .ProjectName != c .client .GetConfig ().ProjectName {
396421 continue
397422 }
@@ -431,10 +456,7 @@ func (c *FeatureStoreClient) lazyLoadProjectData() error {
431456 project .SetApiClient (c .client )
432457 projectData [project .ProjectName ] = project
433458
434- var (
435- pagesize = 100
436- pagenumber = 1
437- )
459+ pagenumber = 1
438460
439461 // get feature entities
440462 for {
0 commit comments