@@ -94,7 +94,7 @@ const PRUNE_REMOTE_DATABASE_MS = 30_000;
9494
9595// never sync more than this many files at once using hot sync
9696// (discards more)
97- const MAX_HOT_SYNC = 200 ;
97+ const MAX_HOT_SYNC = 1_000 ;
9898
9999class FatalSchedulerError extends Error {
100100 constructor ( message : string ) {
@@ -137,6 +137,7 @@ export type SchedulerOptions = {
137137
138138type CycleOptions = {
139139 restrictedPaths ?: string [ ] ;
140+ restrictedPathsFromStdin ?: boolean ;
140141 label ?: string ;
141142} ;
142143
@@ -910,6 +911,7 @@ export async function runScheduler({
910911 numericIds ?: boolean ;
911912 ignoreRules : string [ ] ;
912913 restrictedPaths ?: string [ ] ;
914+ restrictedPathsStdin ?: boolean ;
913915 scanTick ?: number ;
914916 markCaseConflicts ?: boolean ;
915917 caseConflictCaps ?: FilesystemCapabilities ;
@@ -955,12 +957,18 @@ export async function runScheduler({
955957 sshArgs . push ( "--emit-since-age" ) ;
956958 sshArgs . push ( `${ Date . now ( ) - lastRemoteScan . whenOk } ` ) ;
957959 }
958- if ( params . restrictedPaths ?. length ) {
960+ const stdinPaths = params . restrictedPathsStdin
961+ ? ( params . restrictedPaths ?? [ ] )
962+ : [ ] ;
963+ if ( params . restrictedPaths ?. length && ! params . restrictedPathsStdin ) {
959964 for ( const rel of params . restrictedPaths ) {
960965 if ( ! rel ) continue ;
961966 sshArgs . push ( "--restricted-path" , rel ) ;
962967 }
963968 }
969+ if ( stdinPaths . length ) {
970+ sshArgs . push ( "--restricted-paths-stdin" ) ;
971+ }
964972 if ( params . markCaseConflicts ) {
965973 sshArgs . push ( "--mark-case-conflicts" ) ;
966974 if ( params . caseConflictCaps ?. caseInsensitive ) {
@@ -988,8 +996,13 @@ export async function runScheduler({
988996 ) ;
989997
990998 const sshP = spawn ( "ssh" , sshArgs , {
991- stdio : [ "ignore" , "pipe" , "pipe" ] ,
999+ stdio : params . restrictedPathsStdin
1000+ ? [ "pipe" , "pipe" , "pipe" ]
1001+ : [ "ignore" , "pipe" , "pipe" ] ,
9921002 } ) ;
1003+ if ( stdinPaths . length && sshP . stdin ) {
1004+ sshP . stdin . end ( stdinPaths . join ( "\u0000" ) ) ;
1005+ }
9931006 const stderrChunks : string [ ] = [ ] ;
9941007 sshP . stderr ?. on ( "data" , ( chunk ) => {
9951008 const text = chunk . toString ( ) ;
@@ -1692,6 +1705,7 @@ export async function runScheduler({
16921705 if ( ! expandedRestricted . length ) return ;
16931706 await runCycle ( {
16941707 restrictedPaths : expandedRestricted ,
1708+ restrictedPathsFromStdin : alphaIsRemote || betaIsRemote ,
16951709 label : "hot" ,
16961710 } ) ;
16971711 } catch ( e : any ) {
@@ -1973,6 +1987,7 @@ export async function runScheduler({
19731987 numericIds,
19741988 ignoreRules,
19751989 restrictedPaths,
1990+ restrictedPathsStdin : options . restrictedPathsFromStdin ,
19761991 scanTick,
19771992 markCaseConflicts : markAlphaConflicts ,
19781993 caseConflictCaps : alphaCaseConflictCaps ,
@@ -2051,6 +2066,8 @@ export async function runScheduler({
20512066 numericIds,
20522067 ignoreRules,
20532068 restrictedPaths : hasRestrictions ? restrictedPaths : undefined ,
2069+ restrictedPathsStdin :
2070+ options . restrictedPathsFromStdin && hasRestrictions ,
20542071 scanTick,
20552072 markCaseConflicts : markBetaConflicts ,
20562073 caseConflictCaps : betaCaseConflictCaps ,
@@ -2395,7 +2412,11 @@ export async function runScheduler({
23952412 while ( 1 ) {
23962413 let status ;
23972414 if ( restrictedPaths ?. length ) {
2398- status = await runCycle ( { restrictedPaths, label : "hot" } ) ;
2415+ status = await runCycle ( {
2416+ restrictedPaths,
2417+ restrictedPathsFromStdin : alphaIsRemote || betaIsRemote ,
2418+ label : "hot" ,
2419+ } ) ;
23992420 } else {
24002421 status = await runCycle ( ) ;
24012422 }
0 commit comments