##// END OF EJS Templates
speedup: check identity_map when getting by repo name
dan -
r248:1cc12c91 default
parent child Browse files
Show More
@@ -1374,10 +1374,9 b' class Repository(Base, BaseModel):'
1374 @classmethod
1374 @classmethod
1375 def get_by_repo_name(cls, repo_name):
1375 def get_by_repo_name(cls, repo_name):
1376 session = Session()
1376 session = Session()
1377 for (klass, pkey), instance in session.identity_map.items():
1377 for (item_cls, pkey), instance in session.identity_map.items():
1378 if cls == klass:
1378 if cls == item_cls and instance.repo_name == repo_name:
1379 if getattr(instance, 'repo_name') == repo_name:
1379 return instance
1380 return instance
1381
1380
1382 q = session.query(cls).filter(cls.repo_name == repo_name)
1381 q = session.query(cls).filter(cls.repo_name == repo_name)
1383 q = q.options(joinedload(Repository.fork))\
1382 q = q.options(joinedload(Repository.fork))\
General Comments 0
You need to be logged in to leave comments. Login now