mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Check-in: Fix N+1 query issue identified by sentry
This commit is contained in:
@@ -886,7 +886,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
|||||||
if isinstance(auth, Device):
|
if isinstance(auth, Device):
|
||||||
device = auth
|
device = auth
|
||||||
|
|
||||||
last_cis = list(op.checkins.order_by('-datetime').filter(list=clist).only('type', 'nonce'))
|
last_cis = list(op.checkins.order_by('-datetime').filter(list=clist).only('type', 'nonce', 'position_id'))
|
||||||
entry_allowed = (
|
entry_allowed = (
|
||||||
type == Checkin.TYPE_EXIT or
|
type == Checkin.TYPE_EXIT or
|
||||||
clist.allow_multiple_entries or
|
clist.allow_multiple_entries or
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ def _redeem(token_client, org, clist, p, body=None, query=''):
|
|||||||
def test_query_load(token_client, organizer, clist, event, order, django_assert_max_num_queries):
|
def test_query_load(token_client, organizer, clist, event, order, django_assert_max_num_queries):
|
||||||
with scopes_disabled():
|
with scopes_disabled():
|
||||||
p = order.positions.first()
|
p = order.positions.first()
|
||||||
with django_assert_max_num_queries(30):
|
with django_assert_max_num_queries(29):
|
||||||
resp = _redeem(token_client, organizer, clist, p.secret)
|
resp = _redeem(token_client, organizer, clist, p.secret)
|
||||||
assert resp.status_code == 201
|
assert resp.status_code == 201
|
||||||
assert resp.data['status'] == 'ok'
|
assert resp.data['status'] == 'ok'
|
||||||
|
|||||||
Reference in New Issue
Block a user