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
18b3658b
Commit
18b3658b
authored
Feb 26, 2012
by
Arno Töll
Browse files
Do not crash if the server closes the connection after the first iteration
Handle reconnects softly
parent
5cba04b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
debexpo/cronjobs/removeolduploads.py
View file @
18b3658b
...
...
@@ -100,6 +100,7 @@ class RemoveOldUploads(BaseCronjob):
self
.
log
.
debug
(
"Processed all messages up to #%s on %s"
%
(
list_name
.
value
,
list_name
.
code
))
meta
.
session
.
merge
(
list_name
)
meta
.
session
.
commit
()
self
.
mailer
.
disconnect_from_server
()
def
_remove_old_packages
(
self
):
now
=
datetime
.
datetime
.
now
()
...
...
debexpo/lib/email.py
View file @
18b3658b
...
...
@@ -140,8 +140,13 @@ class Email(object):
(
_
,
count
,
first
,
last
,
_
)
=
self
.
nntp
.
group
(
list_name
)
log
.
debug
(
"Fetching messages %s to %s on %s"
%
(
changed_since
,
last
,
list_name
))
except
nntplib
.
NNTPError
as
e
:
self
.
established
=
False
log
.
error
(
"Connecting to NNTP server %s failed: %s"
%
(
pylons
.
config
[
'debexpo.nntp_server'
],
str
(
e
)))
return
except
EOFError
:
self
.
established
=
False
log
.
error
(
"NNTP server %s closed connection"
%
(
pylons
.
config
[
'debexpo.nntp_server'
]))
return
try
:
(
_
,
messages
)
=
self
.
nntp
.
xover
(
str
(
changed_since
),
str
(
last
))
...
...
@@ -168,11 +173,13 @@ class Email(object):
def
disconnect_from_server
(
self
):
self
.
nntp
.
quit
()
self
.
established
=
False
def
connection_established
(
self
):
if
not
self
.
established
:
log
.
debug
(
"Connection to NNTP server not established"
);
return
False
self
.
connect_to_server
()
if
not
self
.
established
:
log
.
debug
(
"Connection to NNTP server not established"
);
return
self
.
established
return
True
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