@@ -2,10 +2,10 @@ import { FileType } from "api";
22import fs from "fs" ;
33import path from "path" ;
44
5+ import * as pathUtils from "../pathUtils" ;
56import LRUCache from "../cache/LRUCache" ;
67import { HumanloopRuntimeError } from "../error" ;
78import { HumanloopClient } from "../humanloop.client" ;
8- import * as pathUtils from "../pathUtils" ;
99
1010// Default cache size for file content caching
1111const DEFAULT_CACHE_SIZE = 100 ;
@@ -257,8 +257,8 @@ export default class FileSyncer {
257257 let page = 1 ;
258258 let totalPages = 0 ;
259259
260- log (
261- `Fetching files from ${ dirPath || "root" } (environment: ${ environment || "default" } )` ,
260+ log (
261+ `Fetching files from ${ dirPath || "root" } (environment: ${ environment || "default" } )` ,
262262 "INFO" ,
263263 this . verbose ,
264264 ) ;
@@ -276,7 +276,8 @@ export default class FileSyncer {
276276
277277 // Calculate total pages on first response
278278 if ( page === 1 ) {
279- totalPages = Math . ceil ( response . total / FileSyncer . PAGE_SIZE ) ;
279+ const actualPageSize = response . size || FileSyncer . PAGE_SIZE ;
280+ totalPages = Math . ceil ( response . total / actualPageSize ) ;
280281 }
281282
282283 if ( response . records . length === 0 ) {
@@ -315,9 +316,8 @@ export default class FileSyncer {
315316 }
316317 }
317318
318- // Update pagination based on items received
319- if ( response . records . length < FileSyncer . PAGE_SIZE ) {
320- // Last page (either partial or empty)
319+ // Check if we've reached the last page
320+ if ( page >= totalPages ) {
321321 break ;
322322 }
323323 page += 1 ;
0 commit comments