Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
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
edx
edx-platform
Commits
a879ad20
Commit
a879ad20
authored
Jul 11, 2017
by
Adeel Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increased timeout value for sailthru api call.
LEARNER-1186
parent
447bee2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
lms/djangoapps/email_marketing/migrations/0006_auto_20170711_0615.py
+19
-0
lms/djangoapps/email_marketing/models.py
+1
-1
lms/djangoapps/email_marketing/signals.py
+2
-1
lms/djangoapps/email_marketing/tests/test_signals.py
+8
-1
No files found.
lms/djangoapps/email_marketing/migrations/0006_auto_20170711_0615.py
0 → 100644
View file @
a879ad20
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'email_marketing'
,
'0005_emailmarketingconfiguration_user_registration_cookie_timeout_delay'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'emailmarketingconfiguration'
,
name
=
'user_registration_cookie_timeout_delay'
,
field
=
models
.
FloatField
(
default
=
3.0
,
help_text
=
'The number of seconds to delay/timeout wait to get cookie values from sailthru.'
),
),
]
lms/djangoapps/email_marketing/models.py
View file @
a879ad20
...
...
@@ -138,7 +138,7 @@ class EmailMarketingConfiguration(ConfigurationModel):
# The number of seconds to delay/timeout wait to get cookie values from sailthru.
user_registration_cookie_timeout_delay
=
models
.
fields
.
FloatField
(
default
=
1.5
,
default
=
3.0
,
help_text
=
_
(
"The number of seconds to delay/timeout wait to get cookie values from sailthru."
)
...
...
lms/djangoapps/email_marketing/signals.py
View file @
a879ad20
...
...
@@ -63,6 +63,7 @@ def add_email_marketing_cookies(sender, response=None, user=None,
sailthru_response
.
get
(
timeout
=
email_config
.
user_registration_cookie_timeout_delay
,
propagate
=
True
)
cookie
=
sailthru_response
.
result
_log_sailthru_api_call_time
(
time_before_call
)
except
TimeoutError
as
exc
:
log
.
error
(
"Timeout error while attempting to obtain cookie from Sailthru:
%
s"
,
unicode
(
exc
))
...
...
@@ -82,7 +83,7 @@ def add_email_marketing_cookies(sender, response=None, user=None,
domain
=
settings
.
SESSION_COOKIE_DOMAIN
,
path
=
'/'
,
)
_log_sailthru_api_call_time
(
time_before_cal
l
)
log
.
info
(
"sailthru_hid cookie:
%
s successfully retrieved for user
%
s"
,
cookie
,
user
.
emai
l
)
return
response
...
...
lms/djangoapps/email_marketing/tests/test_signals.py
View file @
a879ad20
...
...
@@ -98,7 +98,9 @@ class EmailMarketingTests(TestCase):
})
self
.
request
.
COOKIES
[
'anonymous_interest'
]
=
'cookie_content'
mock_get_current_request
.
return_value
=
self
.
request
mock_sailthru
.
return_value
=
SailthruResponse
(
JsonResponse
({
'keys'
:
{
'cookie'
:
'test_cookie'
}}))
cookies
=
{
'cookie'
:
'test_cookie'
}
mock_sailthru
.
return_value
=
SailthruResponse
(
JsonResponse
({
'keys'
:
cookies
}))
with
LogCapture
(
LOGGER_NAME
,
level
=
logging
.
INFO
)
as
logger
:
add_email_marketing_cookies
(
None
,
response
=
response
,
user
=
self
.
user
)
...
...
@@ -108,6 +110,11 @@ class EmailMarketingTests(TestCase):
start
=
datetime
.
datetime
.
now
()
.
isoformat
(
' '
),
end
=
datetime
.
datetime
.
now
()
.
isoformat
(
' '
),
delta
=
0
)
),
(
LOGGER_NAME
,
'INFO'
,
'sailthru_hid cookie:{cookies[cookie]} successfully retrieved for user {user}'
.
format
(
cookies
=
cookies
,
user
=
TEST_EMAIL
)
)
)
mock_sailthru
.
assert_called_with
(
'user'
,
...
...
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