@@ -1818,7 +1818,6 @@ private async void ProcessOperationQueue(CancellationToken cancellationToken, bo
1818
1818
const uint FILE_ACTION_RENAMED_NEW_NAME = 0x00000005 ;
1819
1819
1820
1820
var sampler = new IntervalSampler ( 200 ) ;
1821
- var updateList = new HashSet < string > ( ) ;
1822
1821
bool anyEdits = false ;
1823
1822
1824
1823
try
@@ -1828,8 +1827,8 @@ private async void ProcessOperationQueue(CancellationToken cancellationToken, bo
1828
1827
if ( operationEvent . Wait ( 200 , cancellationToken ) )
1829
1828
{
1830
1829
operationEvent . Reset ( ) ;
1830
+ var updateList = new HashSet < string > ( ) ;
1831
1831
1832
- processQueue :
1833
1832
while ( operationQueue . TryDequeue ( out var operation ) )
1834
1833
{
1835
1834
if ( cancellationToken . IsCancellationRequested ) break ;
@@ -1867,16 +1866,7 @@ private async void ProcessOperationQueue(CancellationToken cancellationToken, bo
1867
1866
}
1868
1867
}
1869
1868
1870
- foreach ( var entry in updateList . ToList ( ) )
1871
- {
1872
- await UpdateFileOrFolderAsync ( entry , hasSyncStatus ) ;
1873
- updateList . Remove ( entry ) ;
1874
-
1875
- if ( sampler . CheckNow ( ) && operationQueue . Any ( i => i . Action != FILE_ACTION_MODIFIED ) )
1876
- {
1877
- goto processQueue ;
1878
- }
1879
- }
1869
+ await UpdateFilesOrFoldersAsync ( updateList , hasSyncStatus ) ;
1880
1870
}
1881
1871
1882
1872
if ( anyEdits )
@@ -2069,7 +2059,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(async () =>
2069
2059
}
2070
2060
}
2071
2061
2072
- private async Task UpdateFileOrFolderAsync ( string path , bool hasSyncStatus = false )
2062
+ private async Task UpdateFilesOrFoldersAsync ( IEnumerable < string > paths , bool hasSyncStatus = false )
2073
2063
{
2074
2064
try
2075
2065
{
@@ -2082,12 +2072,8 @@ private async Task UpdateFileOrFolderAsync(string path, bool hasSyncStatus = fal
2082
2072
2083
2073
try
2084
2074
{
2085
- var matchingItem = filesAndFolders . FirstOrDefault ( x => x . ItemPath . Equals ( path , StringComparison . OrdinalIgnoreCase ) ) ;
2086
-
2087
- if ( matchingItem != null )
2088
- {
2089
- await UpdateFileOrFolderAsync ( matchingItem , hasSyncStatus ) ;
2090
- }
2075
+ var matchingItems = filesAndFolders . Where ( x => paths . Any ( p => p . Equals ( x . ItemPath , StringComparison . OrdinalIgnoreCase ) ) ) ;
2076
+ await Task . WhenAll ( matchingItems . Select ( x => UpdateFileOrFolderAsync ( x , hasSyncStatus ) ) ) ;
2091
2077
}
2092
2078
finally
2093
2079
{
0 commit comments