Skip to content

Commit 6765856

Browse files
authored
Merge pull request #838 from NHSDigital/dtoss-11768-remove-message-status-queue
DTOSS-11768 Remove message status queue
2 parents 28b45d6 + cd37c0d commit 6765856

File tree

8 files changed

+2
-54
lines changed

8 files changed

+2
-54
lines changed

infrastructure/modules/container-apps/alerts.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ resource "azurerm_monitor_scheduled_query_rules_alert_v2" "failure_event" {
4242
# currently this feature is in preview.
4343
resource "azurerm_monitor_scheduled_query_rules_alert_v2" "queue_length_high" {
4444
for_each = var.enable_alerting ? toset([
45-
"notifications-message-status-updates",
4645
"notifications-message-batch-retries"
4746
]) : []
4847

infrastructure/modules/container-apps/jobs.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ locals {
3737
cron_expression = "*/5 * * * *"
3838
environment_variables = {
3939
RETRY_QUEUE_NAME = "notifications-message-batch-retries"
40-
STATUS_UPDATES_QUEUE_NAME = "notifications-message-status-updates"
4140
ENVIRONMENT = var.environment
4241
}
4342
job_short_name = "clm"

infrastructure/modules/container-apps/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ locals {
259259
container_access_type = "private"
260260
}
261261
}
262-
storage_queues = ["notifications-message-status-updates", "notifications-message-batch-retries"]
262+
storage_queues = ["notifications-message-batch-retries"]
263263

264264
always_allowed_paths = ["/sha", "/healthcheck"]
265265
# If allowed_paths is not set, use the module default which allows any pattern

manage_breast_screening/config/.env.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ NBSS_MESH_PRIVATE_KEY="paste-pem-private-key-here"
4444
QUEUE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
4545
REPORTS_CONTAINER_NAME="notifications-reports"
4646
RETRY_QUEUE_NAME="notifications-message-batch-retries"
47-
STATUS_UPDATES_QUEUE_NAME="notifications-message-status-updates"
4847

4948
APPLICATIONINSIGHTS_CONNECTION_STRING=""
5049
APPLICATIONINSIGHTS_STATSBEAT_DISABLED_ALL=True

manage_breast_screening/notifications/management/commands/collect_metrics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Command(BaseCommand):
1212
def handle(self, *args, **options):
1313
try:
1414
queues = [
15-
Queue.MessageStatusUpdates(),
1615
Queue.RetryMessageBatches(),
1716
]
1817

manage_breast_screening/notifications/services/queue.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ def item(self):
6262
def get_message_count(self):
6363
return self.client.get_queue_properties().approximate_message_count
6464

65-
@classmethod
66-
def MessageStatusUpdates(cls):
67-
return cls(
68-
os.getenv(
69-
"STATUS_UPDATES_QUEUE_NAME", "notifications-message-status-updates"
70-
)
71-
)
72-
7365
@classmethod
7466
def RetryMessageBatches(cls):
7567
return cls(os.getenv("RETRY_QUEUE_NAME", "notifications-message-batch-retries"))

manage_breast_screening/notifications/tests/management/commands/test_collect_metrics.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,17 @@ def setup(self, monkeypatch):
1515
@patch(f"{Command.__module__}.Queue")
1616
@patch(f"{Command.__module__}.Metrics")
1717
def test_handle_sends_queue_lengths(self, mock_metrics_class, mock_queue):
18-
mock_status = MagicMock()
19-
mock_status.queue_name = "status_queue"
20-
mock_status.get_message_count.return_value = 2
21-
2218
mock_retry = MagicMock()
2319
mock_retry.queue_name = "retry_queue"
2420
mock_retry.get_message_count.return_value = 5
2521

26-
mock_queue.MessageStatusUpdates.return_value = mock_status
2722
mock_queue.RetryMessageBatches.return_value = mock_retry
2823

2924
Command().handle()
3025

3126
metrics_instance = mock_metrics_class.return_value
3227

33-
assert metrics_instance.set_gauge_value.call_count == 2
34-
metrics_instance.set_gauge_value.assert_any_call(
35-
"queue_size_status_queue",
36-
"messages",
37-
"Queue length",
38-
2,
39-
)
28+
assert metrics_instance.set_gauge_value.call_count == 1
4029
metrics_instance.set_gauge_value.assert_any_call(
4130
"queue_size_retry_queue",
4231
"messages",

manage_breast_screening/notifications/tests/services/test_queue.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@ def test_add_to_queue(self, mock_queue_client):
4141

4242
mock_queue_client.send_message.assert_called_once_with("a message")
4343

44-
def test_message_status_updates_queue(self):
45-
with patch(
46-
"manage_breast_screening.notifications.services.queue.QueueClient"
47-
) as queue_client:
48-
mock_client = MagicMock()
49-
queue_client.from_connection_string.return_value = mock_client
50-
51-
Queue.MessageStatusUpdates().add("some data")
52-
53-
queue_client.from_connection_string.assert_called_once_with(
54-
"qqq111", "notifications-message-status-updates"
55-
)
56-
mock_client.create_queue.assert_called_once()
57-
mock_client.send_message.assert_called_once_with("some data")
58-
5944
def test_items_method_receives_messages(self, mock_queue_client):
6045
mock_queue_client.receive_messages.return_value = ["this", "that"]
6146

@@ -99,20 +84,6 @@ def test_queue_initialises_using_managed_identity_credentials(self, monkeypatch)
9984
client_id="my-mi-id"
10085
)
10186

102-
def test_update_queue_prefers_queue_name_from_env(self, monkeypatch):
103-
monkeypatch.setenv("STATUS_UPDATES_QUEUE_NAME", "updates")
104-
with patch(
105-
"manage_breast_screening.notifications.services.queue.QueueClient"
106-
) as queue_client:
107-
mock_client = MagicMock()
108-
queue_client.from_connection_string.return_value = mock_client
109-
110-
Queue.MessageStatusUpdates()
111-
112-
queue_client.from_connection_string.assert_called_once_with(
113-
"qqq111", "updates"
114-
)
115-
11687
def test_retry_message_batches_queue(self):
11788
with patch(
11889
"manage_breast_screening.notifications.services.queue.QueueClient"

0 commit comments

Comments
 (0)