The Housekeeping service grows in utilization of CPU as more amphorae
are created and/or marked as DELETED. The problem lays on the SELECT
statement constructed in get_all_deleted_expiring_amphora via the ORM --
it is joined eager loading all relationships.
The task does not need such amount of information, only the amphora ID.
The statement could be simplified by not loading any relationship or, at
most, lazy loading them.
This patch also fixes performance of cleaning up deleted and expired
load balancers. The code was doing multiple round-trips to the database
unecessarily:
1. retrieving all deleted LBs
2. for each LB, retrieving it again from DB to check expired date
3. delete LB
Step 1 and 2 are now condensed in get_all_deleted_expiring(), making it
a single round-trip.
Story: 2004665
Task: 28643
Change-Id: Iffc960c7c3a986328cfded1b4e408931ab0a7877