Specific question about git scm implementation: follow on to Defect #9472

Added by John Kubiatowicz almost 6 years ago

Ok. I registered a bug (Defect #9472) which seems to have been rejected out of hand. I was hoping to get a bit more discussion on it. Forgive me if this is the wrong place for this discussion.

The issue is that the fetch_changesets routine in app/model/repository/git.rb executes a self.save for every change it detects in the repository. The result is a lot of after_save events to a plugin that is particularly useful, namely the redmine_git_hosting plugin. There are so many of these events that the plugin is unable to import large repositories (mod_fcgi times out and aborts the import).

Yes, you could claim that this is a bug with the plugin, but this plugin is trying to do something simple: find out when the repository model has been updated (and do something as a result). Yes, I could hack around this, but it would be messy.

I was proposing that there be a single save request at the end instead. This change seems to completely fix the problem with the plugin. And, seems to make importing of large git repos into redmine to be much faster.

Perhaps I misunderstand the code (probably), but I'm not sure what this option cannot work. Are there other observers in redmine that needs save to be executed for every addition to the :extra_info hash? It appears that this hash simply gets bigger with each change and could be saved at the end.

Thanks in advance for your answer.