mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
add debug
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import json
|
import json
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
from app.extensions import redis_client
|
from app.extensions import redis_client
|
||||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||||
|
|
||||||
@@ -81,7 +83,13 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
|||||||
"""
|
"""
|
||||||
Retrieve a list of live services data with contact names and notification counts.
|
Retrieve a list of live services data with contact names and notification counts.
|
||||||
"""
|
"""
|
||||||
return self.get("/service/live-services-data", params=params_dict)
|
try:
|
||||||
|
return self.get("/service/live-services-data", params=params_dict)
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error(
|
||||||
|
f"Error getting live services data {str(e)}", exc_info=True
|
||||||
|
)
|
||||||
|
raise e
|
||||||
|
|
||||||
def get_active_services(self, params_dict=None):
|
def get_active_services(self, params_dict=None):
|
||||||
"""
|
"""
|
||||||
@@ -136,19 +144,29 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
|||||||
|
|
||||||
@cache.delete("live-service-and-organization-counts")
|
@cache.delete("live-service-and-organization-counts")
|
||||||
def update_status(self, service_id, live):
|
def update_status(self, service_id, live):
|
||||||
return self.update_service(
|
try:
|
||||||
service_id,
|
return self.update_service(
|
||||||
message_limit=250000 if live else 50,
|
service_id,
|
||||||
restricted=(not live),
|
message_limit=250000 if live else 50,
|
||||||
go_live_at=str(datetime.utcnow()) if live else None,
|
restricted=(not live),
|
||||||
)
|
go_live_at=str(datetime.utcnow()) if live else None,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error(f"Error updating status {str(e)}", exc_info=True)
|
||||||
|
raise e
|
||||||
|
|
||||||
@cache.delete("live-service-and-organization-counts")
|
@cache.delete("live-service-and-organization-counts")
|
||||||
def update_count_as_live(self, service_id, count_as_live):
|
def update_count_as_live(self, service_id, count_as_live):
|
||||||
return self.update_service(
|
try:
|
||||||
service_id,
|
return self.update_service(
|
||||||
count_as_live=count_as_live,
|
service_id,
|
||||||
)
|
count_as_live=count_as_live,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error(
|
||||||
|
f"Error updating count as live {str(e)}", exc_info=True
|
||||||
|
)
|
||||||
|
raise e
|
||||||
|
|
||||||
# This method is not cached because it calls through to one which is
|
# This method is not cached because it calls through to one which is
|
||||||
def update_service_with_properties(self, service_id, properties):
|
def update_service_with_properties(self, service_id, properties):
|
||||||
|
|||||||
Reference in New Issue
Block a user