File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,21 @@ class ScriptFolderWatcherImpl extends ScriptFolderWatcher {
2929 const invocableScriptsFolderFullPath = join ( this . plugin ?. app . vault . adapter . basePath ?? '' , invocableScriptsFolder ) ;
3030 this . watcher = watch ( invocableScriptsFolderFullPath , { recursive : true } , ( eventType : WatchEventType ) : void => {
3131 if ( eventType === 'rename' ) {
32- invokeAsyncSafely ( ( ) => onChange ( ) ) ;
32+ invokeAsyncSafely ( async ( ) => {
33+ const RETRY_COUNT = 5 ;
34+ const RETRY_DELAY_IN_MILLISECONDS = 100 ;
35+ let lastError : unknown = null ;
36+ for ( let i = 0 ; i < RETRY_COUNT ; i ++ ) {
37+ try {
38+ await onChange ( ) ;
39+ return ;
40+ } catch ( error ) {
41+ await sleep ( RETRY_DELAY_IN_MILLISECONDS ) ;
42+ lastError = error ;
43+ }
44+ }
45+ throw lastError ;
46+ } ) ;
3347 }
3448 } ) ;
3549
You can’t perform that action at this time.
0 commit comments