Commits

Andrew Godwin committed 9285203

Slightly less awfully slow repo invalidation

Comments (0)

Files changed (3)

heechee/repo/git.py

     def mtime(self):
         return time.time()
     
+    def invalidate_repo(self):
+        pass
+    
     ########### Private functions (git -> svn mapping) ###########
     
     def _commit_by_revision(self, revision):

heechee/repo/hg.py

     
     def get_hg_repo(self):
         """
-        We have to invalidate the repo each time, as changes may happen
-        externally - Heechee holds repos objects open for hours, days, etc.
+        This could potentially invalidate the repo each time, but, surprise,
+        that causes massive slowness. It's currently invalidated every request
+        instead.
         """
-        self._hg_repo.invalidate()
+        #self._hg_repo.invalidate()
         return self._hg_repo
     
     hg_repo = property(get_hg_repo)
     
-    
     ########### Public functions (main heechee repo API) ###########
     
     def get_top_revision(self):
             for file_path in important_files
         ])
     
+    def invalidate_repo(self):
+        """
+        Called by the request handler every time we should check if the repo
+        is newer on disk (this currently just invalidates it all the time).
+        """
+        self._hg_repo.invalidate()
+    
     ########### Private functions (hg -> svn mapping) ###########
     
     def _get_first_ancestors(self, changectx):

heechee/webdav/__init__.py

                 self.access_check(request, "write")
             else:
                 self.access_check(request, "read")
+            # Invalidate the repo
+            self.repo.invalidate_repo()
+            # Call the handler
             return getattr(self, request.method)(request)
         except HTTPException, e:
             return e
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.