This repository was archived by the owner on Nov 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-7
lines changed
packages/baseai/src/deploy Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -1122,14 +1122,32 @@ export async function handleGitSyncMemoryDeploy({
11221122 documents : MemoryDocumentI [ ] ;
11231123 overwrite : boolean ;
11241124} ) {
1125- for ( const doc in documents ) {
1126- await new Promise ( resolve => setTimeout ( resolve , 800 ) ) ; // To avoid rate limiting
1127- await handleSingleDocDeploy ( {
1128- memory,
1129- account,
1130- document : documents [ doc ] ,
1131- overwrite : true // TODO: Implement overwrite for git-sync memories
1125+ const BATCH_SIZE = 5 ;
1126+ const RATE_LIMIT_DELAY = 1000 ;
1127+
1128+ // Fetch existing documents once
1129+ const prodDocs = await listMemoryDocuments ( {
1130+ account,
1131+ memoryName : memory . name
1132+ } ) ;
1133+
1134+ // Process in batches
1135+ for ( let i = 0 ; i < documents . length ; i += BATCH_SIZE ) {
1136+ const batch = documents . slice ( i , i + BATCH_SIZE ) ;
1137+ const batchPromises = batch . map ( async ( doc , index ) => {
1138+ await new Promise ( resolve =>
1139+ setTimeout ( resolve , index * RATE_LIMIT_DELAY )
1140+ ) ;
1141+ return handleSingleDocDeploy ( {
1142+ memory,
1143+ account,
1144+ document : doc ,
1145+ overwrite : true ,
1146+ prodDocs
1147+ } ) ;
11321148 } ) ;
1149+
1150+ await Promise . all ( batchPromises ) ;
11331151 }
11341152}
11351153
You can’t perform that action at this time.
0 commit comments