'Twas brillig, and Shane Caraveo at 23/06/09 20:09 did gyre and gimble:
> FYI, by removing gc and the repository sync for each request, I cut
> request time roughly in half depending on the template being requested.
> I'm going to be doing more testing on this, and looking at alternative
> methods to handle these two items.
I found that with the git plugin the sync on every request was *really*
impacting performance.
I hacked up a simple option to disable this automatic sync and set it in
the trac.ini file. This really helped at runtime.
Then in a second change I hacked up a mod to the trac-admin interface to
allow for the incremental sync to be called manually. This call was then
hooked up to the git receive hook (or whatever it's called) so that when
the repository is updated trac was updated, but not at any other times.
I've dug out the patches (they were a bit rough and ready but very
simple) and perhaps someone can apply them for the upcoming release (I
think they are safe enough to add in as it doesn't touch the default
behaviour).
Col
Index: trac/versioncontrol/api.py
===================================================================
--- trac/versioncontrol/api.py (revision 8289)
+++ trac/versioncontrol/api.py (working copy)
@@ -81,7 +81,8 @@
def pre_process_request(self, req, handler):
from trac.web.chrome import Chrome, add_warning
- if handler is not Chrome(self.env):
+ nosync = self.env.config.getbool('trac',
'disable_repository_autosync')
+ if not nosync and handler is not Chrome(self.env):
try:
self.get_repository(req.authname).sync()
except TracError, e:
Index: trac/admin/console.py
===================================================================
--- trac/admin/console.py (revision 8289)
+++ trac/admin/console.py (working copy)
@@ -645,7 +645,7 @@
config_path=os.path.join(self.envname, 'conf', 'trac.ini')))
_help_resync = [('resync', 'Re-synchronize trac with the repository'),
- ('resync <rev>', 'Re-synchronize only the given
<rev>')]
+ ('resync <rev>', 'Re-synchronize only the given
<rev> (if rev is "--latest" it will just sync the repository)')]
def _resync_feedback(self, rev):
sys.stdout.write(' [%s]\r' % rev)
@@ -658,6 +658,10 @@
if argv:
rev = argv[0]
if rev:
+ if "--latest" == rev:
+ repos =
env.get_repository().sync(self._resync_feedback)
+ printout(_("Done."))
+ return
env.get_repository().sync_changeset(rev)
printout(_("%(rev)s resynced.", rev=rev))
return
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---