Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-core
Commits
682f8032
Commit
682f8032
authored
6 years ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
api/asynchronous: replace ayncio coroutines with native ones
parent
577e933e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!47
api/asynchronous: replace ayncio coroutines with native ones
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/core/api/asynchronous.py
+5
-9
5 additions, 9 deletions
swh/core/api/asynchronous.py
with
5 additions
and
9 deletions
swh/core/api/asynchronous.py
+
5
−
9
View file @
682f8032
import
aiohttp.web
import
asyncio
import
json
import
logging
import
multidict
...
...
@@ -18,10 +17,9 @@ def encode_data_server(data, **kwargs):
)
@asyncio.coroutine
def
decode_request
(
request
):
async
def
decode_request
(
request
):
content_type
=
request
.
headers
.
get
(
'
Content-Type
'
)
data
=
yield
from
request
.
read
()
data
=
await
request
.
read
()
if
not
data
:
return
{}
if
content_type
==
'
application/x-msgpack
'
:
...
...
@@ -34,12 +32,10 @@ def decode_request(request):
return
r
@asyncio.coroutine
def
error_middleware
(
app
,
handler
):
@asyncio.coroutine
def
middleware_handler
(
request
):
async
def
error_middleware
(
app
,
handler
):
async
def
middleware_handler
(
request
):
try
:
return
(
yield
from
handler
(
request
))
return
(
await
handler
(
request
))
except
Exception
as
e
:
if
isinstance
(
e
,
aiohttp
.
web
.
HTTPException
):
raise
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment