##// END OF EJS Templates
speedup: check local session for repo by repo name first
dan -
r247:27f3d682 default
parent child Browse files
Show More
@@ -1373,7 +1373,13 b' class Repository(Base, BaseModel):'
1373
1373
1374 @classmethod
1374 @classmethod
1375 def get_by_repo_name(cls, repo_name):
1375 def get_by_repo_name(cls, repo_name):
1376 q = Session().query(cls).filter(cls.repo_name == repo_name)
1376 session = Session()
1377 for (klass, pkey), instance in session.identity_map.items():
1378 if cls == klass:
1379 if getattr(instance, 'repo_name') == repo_name:
1380 return instance
1381
1382 q = session.query(cls).filter(cls.repo_name == repo_name)
1377 q = q.options(joinedload(Repository.fork))\
1383 q = q.options(joinedload(Repository.fork))\
1378 .options(joinedload(Repository.user))\
1384 .options(joinedload(Repository.user))\
1379 .options(joinedload(Repository.group))
1385 .options(joinedload(Repository.group))
General Comments 0
You need to be logged in to leave comments. Login now