Merge "Simplify event count by stack"
This commit is contained in:
commit
bd88cddd43
|
@ -25,6 +25,7 @@ from oslo_utils import timeutils
|
|||
import osprofiler.sqlalchemy
|
||||
import six
|
||||
import sqlalchemy
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.orm import aliased as orm_aliased
|
||||
from sqlalchemy.orm import session as orm_session
|
||||
|
@ -768,7 +769,8 @@ def _events_filter_and_page_query(context, query,
|
|||
|
||||
|
||||
def event_count_all_by_stack(context, stack_id):
|
||||
return _query_all_by_stack(context, stack_id).count()
|
||||
query = model_query(context, func.count(models.Event.id))
|
||||
return query.filter_by(stack_id=stack_id).scalar()
|
||||
|
||||
|
||||
def _delete_event_rows(context, stack_id, limit):
|
||||
|
|
Loading…
Reference in New Issue