Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
acc7da35
Verified
Commit
acc7da35
authored
Mar 07, 2020
by
Baptiste Beauplat
Browse files
Add a default timeout for socket operation to the importer of 30s (Closes
#94
)
parent
521196ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/debexpo_worker.py
View file @
acc7da35
...
@@ -48,6 +48,7 @@ import pylons
...
@@ -48,6 +48,7 @@ import pylons
import
optparse
import
optparse
import
signal
import
signal
import
datetime
import
datetime
from
socket
import
setdefaulttimeout
from
paste.deploy
import
appconfig
from
paste.deploy
import
appconfig
from
debexpo.config.environment
import
load_environment
from
debexpo.config.environment
import
load_environment
...
@@ -75,6 +76,9 @@ class Worker(object):
...
@@ -75,6 +76,9 @@ class Worker(object):
self
.
can_continue
=
True
self
.
can_continue
=
True
signal
.
signal
(
signal
.
SIGTERM
,
self
.
_on_sig_term
)
signal
.
signal
(
signal
.
SIGTERM
,
self
.
_on_sig_term
)
# Set default socket timeout to 30s to avoid hanging indefinitely
setdefaulttimeout
(
30
)
def
_on_sig_term
(
self
,
sig
,
frame
):
def
_on_sig_term
(
self
,
sig
,
frame
):
log
.
info
(
"Received SIGTERM, shutting down worker after current run."
)
log
.
info
(
"Received SIGTERM, shutting down worker after current run."
)
self
.
_remove_pid
()
self
.
_remove_pid
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment