# HG changeset patch # User paulb # Date 1127830681 0 # Node ID b18381a29301284b06faa6d874ddc3b0c12a0f08 # Parent 97103996bad14495f473c256c1a0dc66556357a8 [project @ 2005-09-27 14:18:01 by paulb] Introduced active and remove method calls on the Exchange object along with explicit closing of channels. Changed the program arguments so that a directory is supplied and the list of filenames is obtained using that information. diff -r 97103996bad1 -r b18381a29301 tests/start_indexer.py --- a/tests/start_indexer.py Tue Sep 27 14:16:48 2005 +0000 +++ b/tests/start_indexer.py Tue Sep 27 14:18:01 2005 +0000 @@ -21,20 +21,23 @@ # Start listening for responses. exchange = Exchange(channels) - while len(channels) > 0: - print "Waiting for %d channels..." % len(channels) + while exchange.active(): + print "Waiting for %d channels..." % exchange.active() for channel in exchange.ready(): index = channel.receive() update(master_index, index) - channels.remove(channel) + exchange.remove(channel) + channel.close() # Provide a search interface. return Searcher(master_index) if __name__ == "__main__": - import sys - window_size, filenames = int(sys.argv[1]), sys.argv[2:] + import sys, os + window_size, directory = int(sys.argv[1]), sys.argv[2] + filenames = [os.path.join(directory, filename) for filename in os.listdir(directory)] + searcher = get_searcher(filenames, window_size) while 1: print "Pattern:",