File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,12 @@ public IEnumerable<IIssue> ReadIssues()
46
46
{
47
47
var stopwatch = Stopwatch . StartNew ( ) ;
48
48
49
- // Use thread-safe collection for collecting results
50
- var allIssues = new ConcurrentBag < IIssue > ( ) ;
49
+ var results = new List < IIssue > [ this . issueProviders . Count ] ;
51
50
52
51
// Process providers in parallel
53
- _ = Parallel . ForEach ( this . issueProviders , issueProvider =>
52
+ _ = Parallel . For ( 0 , this . issueProviders . Count , i =>
54
53
{
54
+ var issueProvider = this . issueProviders [ i ] ;
55
55
var providerName = issueProvider . GetType ( ) . Name ;
56
56
this . log . Verbose ( "Initialize issue provider {0}..." , providerName ) ;
57
57
@@ -76,21 +76,18 @@ public IEnumerable<IIssue> ReadIssues()
76
76
}
77
77
} ) ;
78
78
79
- // Add to thread-safe collection
80
- foreach ( var issue in currentIssues )
81
- {
82
- allIssues . Add ( issue ) ;
83
- }
79
+ results [ i ] = currentIssues ;
84
80
}
85
81
else
86
82
{
87
83
this . log . Warning ( "Error initializing issue provider {0}." , providerName ) ;
84
+ results [ i ] = [ ] ;
88
85
}
89
86
} ) ;
90
87
91
88
stopwatch . Stop ( ) ;
92
89
93
- var issuesList = allIssues . ToList ( ) ;
90
+ var issuesList = results . SelectMany ( r => r ) . ToList ( ) ;
94
91
this . log . Verbose (
95
92
"Reading {0} issues from {1} providers took {2} ms" ,
96
93
issuesList . Count ,
You can’t perform that action at this time.
0 commit comments