Remove unnecessary joinedload

This patch removes an unnecessary joinedload when looking up a
load balancer from an amphora ID. This should reduce the database
load when this method is called.

Change-Id: I04bb38c657c87ace941eb6e332f58f7218980ad1
This commit is contained in:
Michael Johnson 2020-07-14 09:03:57 -07:00 committed by Ann Taraday
parent a28bc2a55a
commit b627d7cf72
1 changed files with 1 additions and 5 deletions

View File

@ -27,7 +27,6 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils
from oslo_utils import uuidutils
from sqlalchemy.orm import joinedload
from sqlalchemy.orm import noload
from sqlalchemy.orm import subqueryload
from sqlalchemy.sql import func
@ -1368,10 +1367,7 @@ class AmphoraRepository(BaseRepository):
.filter(models.Amphora.status != consts.DELETED)
# And the LB is also not DELETED
.filter(models.LoadBalancer.provisioning_status !=
consts.DELETED)
# And what does this do? Some SQLAlchemy magic?
.options(joinedload('*'))
).first()
consts.DELETED)).first()
if db_lb:
return db_lb.to_data_model()
return None