File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
Plugins/Flow.Launcher.Plugin.Program Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -88,21 +88,24 @@ public async Task InitAsync(PluginInitContext context)
88
88
89
89
bool cacheEmpty = ! _win32s . Any ( ) && ! _uwps . Any ( ) ;
90
90
91
- var a = Task . Run ( ( ) =>
91
+ if ( cacheEmpty || _settings . LastIndexTime . AddHours ( 30 ) < DateTime . Now )
92
92
{
93
- Stopwatch . Normal ( "|Flow.Launcher.Plugin.Program.Main|Win32Program index cost" , IndexWin32Programs ) ;
94
- } ) ;
95
-
96
- var b = Task . Run ( ( ) =>
93
+ _ = Task . Run ( async ( ) =>
94
+ {
95
+ await IndexProgramsAsync ( ) . ConfigureAwait ( false ) ;
96
+ WatchProgramUpdate ( ) ;
97
+ } ) ;
98
+ }
99
+ else
97
100
{
98
- Stopwatch . Normal ( "|Flow.Launcher.Plugin.Program.Main|UWPPRogram index cost" , IndexUwpPrograms ) ;
99
- } ) ;
100
-
101
- if ( cacheEmpty )
102
- await Task . WhenAll ( a , b ) ;
101
+ WatchProgramUpdate ( ) ;
102
+ }
103
103
104
- Win32 . WatchProgramUpdate ( _settings ) ;
105
- _ = UWP . WatchPackageChange ( ) ;
104
+ static void WatchProgramUpdate ( )
105
+ {
106
+ Win32 . WatchProgramUpdate ( _settings ) ;
107
+ _ = UWP . WatchPackageChange ( ) ;
108
+ }
106
109
}
107
110
108
111
public static void IndexWin32Programs ( )
You can’t perform that action at this time.
0 commit comments