##// END OF EJS Templates
git hook handler shouldn't ever use cache instances...
marcink -
r3278:c2bf0fa7 beta
parent child Browse files
Show More
@@ -382,7 +382,12 b' def handle_git_receive(repo_path, revs, '
382
382
383 for k, v in extras.items():
383 for k, v in extras.items():
384 baseui.setconfig('rhodecode_extras', k, v)
384 baseui.setconfig('rhodecode_extras', k, v)
385 repo = repo.scm_instance
385 if hook_type == 'pre':
386 repo = repo.scm_instance
387 else:
388 #post push shouldn't use the cached instance never
389 repo = repo.scm_instance_no_cache
390
386 repo.ui = baseui
391 repo.ui = baseui
387
392
388 if hook_type == 'pre':
393 if hook_type == 'pre':
@@ -229,9 +229,6 b' class SimpleGit(BaseVCSController):'
229
229
230 try:
230 try:
231 self._handle_githooks(repo_name, action, baseui, environ)
231 self._handle_githooks(repo_name, action, baseui, environ)
232 # invalidate cache on push
233 if action == 'push':
234 self._invalidate_cache(repo_name)
235 log.info('%s action on GIT repo "%s" by "%s" from %s' %
232 log.info('%s action on GIT repo "%s" by "%s" from %s' %
236 (action, repo_name, username, ip_addr))
233 (action, repo_name, username, ip_addr))
237 app = self.__make_app(repo_name, repo_path, extras)
234 app = self.__make_app(repo_name, repo_path, extras)
@@ -242,6 +239,10 b' class SimpleGit(BaseVCSController):'
242 except Exception:
239 except Exception:
243 log.error(traceback.format_exc())
240 log.error(traceback.format_exc())
244 return HTTPInternalServerError()(environ, start_response)
241 return HTTPInternalServerError()(environ, start_response)
242 finally:
243 # invalidate cache on push
244 if action == 'push':
245 self._invalidate_cache(repo_name)
245
246
246 def __make_app(self, repo_name, repo_path, extras):
247 def __make_app(self, repo_name, repo_path, extras):
247 """
248 """
@@ -191,9 +191,6 b' class SimpleHg(BaseVCSController):'
191 self.__inject_extras(repo_path, baseui, extras)
191 self.__inject_extras(repo_path, baseui, extras)
192
192
193 try:
193 try:
194 # invalidate cache on push
195 if action == 'push':
196 self._invalidate_cache(repo_name)
197 log.info('%s action on HG repo "%s" by "%s" from %s' %
194 log.info('%s action on HG repo "%s" by "%s" from %s' %
198 (action, repo_name, username, ip_addr))
195 (action, repo_name, username, ip_addr))
199 app = self.__make_app(repo_path, baseui, extras)
196 app = self.__make_app(repo_path, baseui, extras)
@@ -207,6 +204,10 b' class SimpleHg(BaseVCSController):'
207 except Exception:
204 except Exception:
208 log.error(traceback.format_exc())
205 log.error(traceback.format_exc())
209 return HTTPInternalServerError()(environ, start_response)
206 return HTTPInternalServerError()(environ, start_response)
207 finally:
208 # invalidate cache on push
209 if action == 'push':
210 self._invalidate_cache(repo_name)
210
211
211 def __make_app(self, repo_name, baseui, extras):
212 def __make_app(self, repo_name, baseui, extras):
212 """
213 """
@@ -1096,6 +1096,10 b' class Repository(Base, BaseModel):'
1096 CacheInvalidation.set_invalidate(repo_name=self.repo_name)
1096 CacheInvalidation.set_invalidate(repo_name=self.repo_name)
1097
1097
1098 @LazyProperty
1098 @LazyProperty
1099 def scm_instance_no_cache(self):
1100 return self.__get_instance()
1101
1102 @LazyProperty
1099 def scm_instance(self):
1103 def scm_instance(self):
1100 import rhodecode
1104 import rhodecode
1101 full_cache = str2bool(rhodecode.CONFIG.get('vcs_full_cache'))
1105 full_cache = str2bool(rhodecode.CONFIG.get('vcs_full_cache'))
General Comments 0
You need to be logged in to leave comments. Login now