repositories_controller queries SCM adapter even when all changes are cached in db
Latest/head version of redmine synced from edavis' Git mirror this morning, running on Windows Vista 64-bit, ruby 1.8.6 (2008-08-11 patchlevel 287), rails 2.3.5, sqlite3.
I have a remote repository which I access using a custom Perforce adapter I wrote for Redmine which is patterned on the Subversion adapter. Access to this repository is slow, and the repo has many changes/files, so local caching is important. However I've found that Redmine goes out to the repo even when auto-fetching is disabled. I put a breakpoint in my adapter's entries method and this is some of the relevant tidbits from the rdebug session:
(rdb:97) l [74, 83] in D:/redmine/app/controllers/repositories_controller.rb 74 end 75 76 def show 77 @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? 78 => 79 @entries = @repository.entries(@path, @rev) 80 if request.xhr? 81 @entries ? render(:partial => 'dir_list_content') : render(:nothing => true) 82 else 83 (show_error_not_found; return) unless @entries (rdb:97) p Setting.autofetch_changesets? false (rdb:97) bt #0 Redmine::Scm::Adapters::PerforceAdapter.entries(path#String, identifier#NilClass,...) at line D:/redmine/lib/redmine/scm/adapters/perforce_adapter.rb:68 #1 Repository.entries(path#String, identifier#NilClass) at line D:/redmine/app/models/repository.rb:63 #2 Kernel.send(method#Symbol, args#Array) at line C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217 #3 ActiveRecord::Associations::AssociationProxy.method_missing at line C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217 --> #4 RepositoriesController.show at line D:/redmine/app/controllers/repositories_controller.rb:79 [etc.]
The slightly wonky thing (to me) is that the model (eg app/models/repository/perforce.rb in my case, but again patterned off of the svn adapter which does the same thing) in fetch_changesets does its own caching; it checks latest scm vs db revision and only grabs more if its been updated (and this works properly). But the repositories_controller invokes the scm adapter directly from what I can tell. So my question is, am I missing something obvious in my adapter implementation (doesn't seem likely, I've basically mirrored the svn implementation), or is this a defect in the general relationship between the controller/model/and adapters? I've also attached a snippet from the log file that shows the output in development. Thanks!
Updated by Michael Vance almost 13 years ago
- File redmine-about.txt redmine-about.txt added
Adding script/about per edavis.
Updated by Jean-Philippe Lang almost 13 years ago
- Status changed from New to Closed
- Resolution set to Invalid
Changeset caching is mainly used by the search engine. When you browse a Subversion repository, there are some queries on the repository to get directory content and history log.
Updated by Toshi MARUYAMA over 10 years ago
- Category set to SCM