adium 3838:c6fcf1eb8953: SearchKit doesn't let us search while w...

commits at adium.im commits at adium.im
Sat Apr 2 23:35:47 UTC 2011


details:	http://hg.adium.im/adium/rev/c6fcf1eb8953
revision:	3838:c6fcf1eb8953
branch:		AILoggerWithBlocks
author:		Stephen Holt <sholt at adium.im>
date:		Sat Apr 02 16:35:33 2011 -0700

SearchKit doesn't let us search while we're flushing the index, so only fiush (in the background) when we close the search window, not immediately after we index.

There is a potential to appear to hang on quit here (when saving large changes to the searchIndex), so we need to devise some way to message the user this is happening if it's preventing quit.

The typical case is an incremental addition to the existing search index which takes next to no time at all.

diffs (44 lines):

diff -r 07951032185e -r c6fcf1eb8953 Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m	Sat Apr 02 15:58:47 2011 -0700
+++ b/Source/AILoggerPlugin.m	Sat Apr 02 16:35:33 2011 -0700
@@ -302,7 +302,8 @@
 - (void)uninstallPlugin
 {
 	[self cancelIndexing];
-	dispatch_group_wait(logIndexingGroup, DISPATCH_TIME_FOREVER);
+	[self _closeLogIndex];
+	dispatch_group_wait(closingIndexGroup, DISPATCH_TIME_FOREVER);
 	[[NSNotificationCenter defaultCenter] removeObserver:self];
 	[adium.preferenceController removeObserver:self forKeyPath:PREF_KEYPATH_LOGGER_ENABLE];
 }
@@ -1498,16 +1499,13 @@
 			}
 			dispatch_group_leave(logIndexingGroup);
 			dispatch_group_notify(logIndexingGroup, searchIndexQueue, ^{
-				bself.indexIsFlushing = YES;
 				dispatch_async(dispatch_get_main_queue(), ^{
 					[[AILogViewerWindowController existingWindowController] logIndexingProgressUpdate];
 				});
-				[bself _flushIndex:searchIndex];
 				AILogWithSignature(@"After cleaning dirty logs, the search index has a max ID of %i and a count of %i",
 								   SKIndexGetMaximumDocumentID(searchIndex),
 								   SKIndexGetDocumentCount(searchIndex));
 				[bself _didCleanDirtyLogs];
-				bself.indexIsFlushing = NO;
 			});
 		}));
 	}
@@ -1594,11 +1592,13 @@
 {
 	NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
 	if (inIndex) {
+		self.indexIsFlushing = YES;
 		AILogWithSignature(@"**** Flushing index %p",inIndex);
 		CFRetain(inIndex);
 		SKIndexFlush(inIndex);
 		CFRelease(inIndex);
 		AILogWithSignature(@"**** Finished flushing index %p, and released it",inIndex);
+		self.indexIsFlushing = NO;
 	}
 	
 	[pool release];




More information about the commits mailing list