mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Use NSOperation's maxConcurrentOperationCount
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
|
||||
PBGitHistoryGrapher *grapher;
|
||||
NSOperationQueue *graphQueue;
|
||||
NSInvocationOperation *lastOperation;
|
||||
|
||||
NSMutableArray *commits;
|
||||
BOOL isUpdating;
|
||||
|
||||
+2
-7
@@ -131,8 +131,8 @@
|
||||
if (graphQueue)
|
||||
[graphQueue removeObserver:self forKeyPath:@"operations"];
|
||||
graphQueue = [[NSOperationQueue alloc] init];
|
||||
[graphQueue setMaxConcurrentOperationCount:1];
|
||||
[graphQueue addObserver:self forKeyPath:@"operations" options:0 context:@"operations"];
|
||||
lastOperation = nil;
|
||||
|
||||
grapher = [self grapher];
|
||||
}
|
||||
@@ -140,12 +140,7 @@
|
||||
|
||||
- (NSInvocationOperation *) operationForCommits:(NSArray *)newCommits
|
||||
{
|
||||
NSInvocationOperation *graphOperation = [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits];
|
||||
if (lastOperation)
|
||||
[graphOperation addDependency:lastOperation];
|
||||
lastOperation = graphOperation;
|
||||
|
||||
return graphOperation;
|
||||
return [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user