##// END OF EJS Templates
api: don't report invalidated cache_keys after invalidating a repo...
Mads Kiilerich -
r3759:12ca667b beta
parent child Browse files
Show More
@@ -171,7 +171,7 b' INPUT::'
171 171 OUTPUT::
172 172
173 173 id : <id_given_in_input>
174 result : "Cache for repository `<reponame>` was invalidated: invalidated cache keys: <list_of_cache_keys>"
174 result : "Caches of repository `<reponame>`"
175 175 error : null
176 176
177 177 lock
@@ -220,9 +220,8 b' class ApiController(JSONRPCController):'
220 220 raise JSONRPCError('repository `%s` does not exist' % (repoid))
221 221
222 222 try:
223 invalidated_keys = ScmModel().mark_for_invalidation(repo.repo_name)
224 return ('Cache for repository `%s` was invalidated: '
225 'invalidated cache keys: %s' % (repoid, invalidated_keys))
223 ScmModel().mark_for_invalidation(repo.repo_name)
224 return ('Caches of repository `%s` was invalidated' % repoid)
226 225 except Exception:
227 226 log.error(traceback.format_exc())
228 227 raise JSONRPCError(
@@ -1857,7 +1857,6 b' class CacheInvalidation(Base, BaseModel)'
1857 1857 """
1858 1858 Mark all caches of a repo as invalid in the database.
1859 1859 """
1860 invalidated_keys = []
1861 1860 inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all()
1862 1861
1863 1862 try:
@@ -1865,13 +1864,11 b' class CacheInvalidation(Base, BaseModel)'
1865 1864 log.debug('marking %s key for invalidation based on repo_name=%s'
1866 1865 % (inv_obj, safe_str(repo_name)))
1867 1866 inv_obj.cache_active = False
1868 invalidated_keys.append(inv_obj.cache_key)
1869 1867 Session().add(inv_obj)
1870 1868 Session().commit()
1871 1869 except Exception:
1872 1870 log.error(traceback.format_exc())
1873 1871 Session().rollback()
1874 return invalidated_keys
1875 1872
1876 1873 @classmethod
1877 1874 def set_valid(cls, cache_key):
@@ -322,11 +322,10 b' class ScmModel(BaseModel):'
322 322
323 323 :param repo_name: the repo for which caches should be marked invalid
324 324 """
325 invalidated_keys = CacheInvalidation.set_invalidate(repo_name)
325 CacheInvalidation.set_invalidate(repo_name)
326 326 repo = Repository.get_by_repo_name(repo_name)
327 327 if repo:
328 328 repo.update_changeset_cache()
329 return invalidated_keys
330 329
331 330 def toggle_following_repo(self, follow_repo_id, user_id):
332 331
@@ -268,9 +268,7 b' class BaseTestApi(object):'
268 268 repoid=self.REPO)
269 269 response = api_call(self, params)
270 270
271 expected = ("Cache for repository `%s` was invalidated: "
272 "invalidated cache keys: %s" % (self.REPO,
273 [unicode(self.REPO)]))
271 expected = ("Caches of repository `%s` was invalidated" % (self.REPO))
274 272 self._compare_ok(id_, expected, given=response.body)
275 273
276 274 @mock.patch.object(ScmModel, 'mark_for_invalidation', crash)
General Comments 0
You need to be logged in to leave comments. Login now