Skip to content

Commit

Permalink
Adding timezone info to published dates (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrlee authored Apr 17, 2024
1 parent 4483372 commit 1fd4d6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ SERVICE_CATALOGUE_API_KEY=
REDIS_ENDPOINT=localhost
REDIS_PORT=6379
REDIS_TLS_ENABLED=false
SERVICE_CATALOGUE_FILTER=&filters[name][$contains]=book-a-prison-visit-staff-ui
8 changes: 4 additions & 4 deletions health_ping.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
'''Health ping - fetches all /health and /info endpoints and stores the results in Redis'''
from datetime import datetime
from datetime import datetime, timezone
import os
import threading
import logging
Expand Down Expand Up @@ -44,7 +44,7 @@ def update_sc_component(c_id, data):

def update_app_version(app_version, c_name, e_name):
version_key = f'version:{c_name}:{e_name}'
version_data={'v': app_version, 'dateAdded': datetime.now().isoformat()}
version_data={'v': app_version, 'dateAdded': datetime.now(timezone.utc).isoformat()}
try:
# Get last entry to version stream
last_entry_version = redis.xrevrange(version_key, max='+', min='-', count=1)
Expand All @@ -70,8 +70,8 @@ def process_env(c_name, e_name, endpoint, endpoint_type, component):
stream_key = f'{endpoint_type}:{c_name}:{e_name}'
stream_data = {}
stream_data.update({'url': endpoint})
stream_data.update({'dateAdded': datetime.now().isoformat()})
stream_data.update({'dateAdded': datetime.now(timezone.utc).isoformat()})

try:
# Override default User-Agent other gets blocked by mod security.
headers = {'User-Agent': 'hmpps-health-ping'}
Expand Down

0 comments on commit 1fd4d6c

Please sign in to comment.