Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
4dd6c55c
Commit
4dd6c55c
authored
Sep 02, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #587 (Better handling of errors in sending email)
parent
c3b04928
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
worker.py
cps/worker.py
+17
-10
No files found.
cps/worker.py
View file @
4dd6c55c
...
@@ -403,15 +403,14 @@ class WorkerThread(threading.Thread):
...
@@ -403,15 +403,14 @@ class WorkerThread(threading.Thread):
msg
[
'To'
]
=
obj
[
'recipent'
]
msg
[
'To'
]
=
obj
[
'recipent'
]
use_ssl
=
int
(
obj
[
'settings'
]
.
get
(
'mail_use_ssl'
,
0
))
use_ssl
=
int
(
obj
[
'settings'
]
.
get
(
'mail_use_ssl'
,
0
))
# convert MIME message to string
fp
=
StringIO
()
gen
=
Generator
(
fp
,
mangle_from_
=
False
)
gen
.
flatten
(
msg
)
msg
=
fp
.
getvalue
()
# send email
try
:
try
:
# convert MIME message to string
fp
=
StringIO
()
gen
=
Generator
(
fp
,
mangle_from_
=
False
)
gen
.
flatten
(
msg
)
msg
=
fp
.
getvalue
()
# send email
timeout
=
600
# set timeout to 5mins
timeout
=
600
# set timeout to 5mins
org_stderr
=
sys
.
stderr
org_stderr
=
sys
.
stderr
...
@@ -441,9 +440,17 @@ class WorkerThread(threading.Thread):
...
@@ -441,9 +440,17 @@ class WorkerThread(threading.Thread):
sys
.
stderr
=
org_stderr
sys
.
stderr
=
org_stderr
except
(
socket
.
error
,
smtplib
.
SMTPRecipientsRefused
,
smtplib
.
SMTPException
)
as
e
:
except
(
MemoryError
)
as
e
:
self
.
_handleError
(
e
)
self
.
_handleError
(
u'Error sending email: '
+
e
.
message
)
return
None
except
(
smtplib
.
SMTPException
)
as
e
:
self
.
_handleError
(
u'Error sending email: '
+
e
.
smtp_error
.
replace
(
"
\n
"
,
'. '
))
return
None
return
None
except
(
socket
.
error
)
as
e
:
self
.
_handleError
(
u'Error sending email: '
+
e
.
strerror
)
return
None
def
_formatRuntime
(
self
,
runtime
):
def
_formatRuntime
(
self
,
runtime
):
self
.
UIqueue
[
self
.
current
][
'rt'
]
=
runtime
.
total_seconds
()
self
.
UIqueue
[
self
.
current
][
'rt'
]
=
runtime
.
total_seconds
()
...
...
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