Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
98cc2f3e
Commit
98cc2f3e
authored
Nov 14, 2013
by
Giorgos Korfiatis
Browse files
astakos: Speed up POST /tokens
Prefetch endpoint entries to avoid multiple queries.
parent
0319a41b
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/api/tokens.py
View file @
98cc2f3e
...
...
@@ -102,10 +102,11 @@ def authenticate(request):
d
[
"access"
][
"serviceCatalog"
]
=
[]
append
=
d
[
"access"
][
"serviceCatalog"
].
append
for
s
in
Service
.
objects
.
all
().
order_by
(
"id"
):
for
s
in
Service
.
objects
.
all
().
order_by
(
"id"
).
\
prefetch_related
(
'endpoints__data'
).
select_related
(
'component'
):
endpoints
=
[]
for
l
in
[
e
.
data
.
values
(
'key'
,
'value'
)
for
e
in
s
.
endpoints
.
all
()
]
:
endpoint
=
dict
((
d
[
'key'
],
d
[
'
value
'
]
)
for
d
in
l
)
for
e
in
s
.
endpoints
.
all
():
endpoint
=
dict
((
ed
.
key
,
ed
.
value
)
for
e
d
in
e
.
data
.
all
()
)
endpoint
[
"SNF:uiURL"
]
=
s
.
component
.
url
endpoint
[
"region"
]
=
"default"
if
s
.
name
==
'astakos_weblogin'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment