Merge pull request #815 from alphagov/fix-perf-platform-stats-job

Fix perf platform stats job
This commit is contained in:
imdadahad
2017-02-03 14:01:25 +00:00
committed by GitHub
3 changed files with 15 additions and 16 deletions

View File

@@ -1,8 +1,7 @@
import base64
import json
import requests
from datetime import datetime
from requests import request
from flask import current_app
from app.utils import (
@@ -30,7 +29,7 @@ class PerformancePlatformClient:
def send_performance_stats(self, date, channel, count, period):
if self.active:
payload = {
'_timestamp': str(date),
'_timestamp': date.isoformat(),
'service': 'govuk-notify',
'channel': channel,
'count': count,
@@ -62,10 +61,9 @@ class PerformancePlatformClient:
'Content-Type': "application/json",
'Authorization': 'Bearer {}'.format(self.bearer_token)
}
resp = request(
"POST",
resp = requests.post(
self.performance_platform_url,
data=json.dumps(payload),
json=payload,
headers=headers
)

View File

@@ -126,7 +126,7 @@ class Config(object):
},
'send-daily-performance-platform-stats': {
'task': 'send-daily-performance-platform-stats',
'schedule': crontab(minute=30, hour=0), # 00:30
'schedule': crontab(minute='*/10'), # Every 10 minutes
'options': {'queue': 'periodic'}
},
'timeout-sending-notifications': {
@@ -156,10 +156,11 @@ class Config(object):
SENDING_NOTIFICATIONS_TIMEOUT_PERIOD = 259200 # 3 days
SIMULATED_EMAIL_ADDRESSES = ('simulate-delivered@notifications.service.gov.uk',
'simulate-delivered-2@notifications.service.gov.uk',
'simulate-delivered-3@notifications.service.gov.uk',
)
SIMULATED_EMAIL_ADDRESSES = (
'simulate-delivered@notifications.service.gov.uk',
'simulate-delivered-2@notifications.service.gov.uk',
'simulate-delivered-3@notifications.service.gov.uk',
)
SIMULATED_SMS_NUMBERS = ('+447700900000', '+447700900111', '+447700900222')