Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
prozorro-sale
Prozorro metrics
Commits
5e9fd22d
Commit
5e9fd22d
authored
Sep 24, 2020
by
Andrey Veltischev
Browse files
Remove endless sleep from aiohttp, run until complete cancelled tasks
parent
f7e26736
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/prozorro_sale/metrics/__init__.py
View file @
5e9fd22d
...
...
@@ -38,8 +38,6 @@ class AioAppWrapper:
await
self
.
runner
.
setup
()
site
=
web
.
TCPSite
(
self
.
runner
,
'0.0.0.0'
,
self
.
port
)
await
site
.
start
()
while
True
:
await
asyncio
.
sleep
(
3600
)
def
shutdown
(
self
):
LOG
.
info
(
'Shutdown aiohttp app'
)
...
...
@@ -95,11 +93,14 @@ class ApplicationWrapper:
def
run_all
(
self
):
self
.
handle_signal
(
signal
.
SIGTERM
,
_raise_graceful_exit
)
self
.
handle_signal
(
signal
.
SIGHUP
,
_raise_graceful_exit
)
tasks
=
asyncio
.
gather
(
*
[
app
.
initialize
()
for
app
in
self
.
apps
])
try
:
LOG
.
info
(
'Start serving'
)
self
.
loop
.
run_until_complete
(
asyncio
.
gather
(
*
[
app
.
initialize
()
for
app
in
self
.
apps
])
)
self
.
loop
.
run_until_complete
(
tasks
)
except
KeyboardInterrupt
:
pass
finally
:
for
app
in
self
.
apps
:
app
.
shutdown
()
self
.
loop
.
run_until_complete
(
tasks
)
print
(
'Stopping main wrapper'
)
Write
Preview
Supports
Markdown
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