To edit pages or tickets please login with username/password: aaf/aaf

Changeset 288

Show
Ignore:
Timestamp:
12/16/07 17:33:39 (10 months ago)
Author:
jk
Message:

fix file handle leakage in rebuild_index via DRb, thanks to Chris Heald for discovering this

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugin/acts_as_ferret/lib/class_methods.rb

    r286 r288  
    9595    def index_dir=(dir) 
    9696      logger.debug "changing index dir to #{dir}" 
     97      # get a handle to the index before changing the directory (which serves 
     98      # as the key to retrieve the index instance in aaf_index method below) 
     99      idx = aaf_index 
     100      old_dir = aaf_configuration[:index_dir] 
    97101      aaf_configuration[:index_dir] = aaf_configuration[:ferret][:path] = dir 
    98       aaf_index.reopen! 
     102      # store index reference with new directory 
     103      ActsAsFerret::ferret_indexes[aaf_configuration[:index_dir]] = idx 
     104      # clean old reference to index 
     105      ActsAsFerret::ferret_indexes.delete old_dir 
     106      idx.reopen! 
    99107      logger.debug "index dir is now #{dir}" 
    100108    end 

To edit pages or tickets please login with username/password: aaf/aaf