Browse Source

Merge "Pick stale amphora randomly" into stable/stein

tags/4.1.2
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
22f8deab03
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      octavia/db/repositories.py

+ 3
- 1
octavia/db/repositories.py View File

@@ -30,6 +30,7 @@ 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

from octavia.common import constants as consts
from octavia.common import data_models
@@ -1466,7 +1467,8 @@ class AmphoraHealthRepository(BaseRepository):

amp = session.query(self.model_class).with_for_update().filter_by(
busy=False).filter(
self.model_class.last_update < expired_time).first()
self.model_class.last_update < expired_time).order_by(
func.random()).first()

if amp is None:
return None


Loading…
Cancel
Save