Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRMP-1408 - ORC-OUT Global Secondary Index Delay #145

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const config = () => ({
repositoryAsid: process.env.REPOSITORY_ASID,
fragmentTransferRateLimitTimeoutMilliseconds:
process.env.FRAGMENT_TRANSFER_RATE_LIMIT_TIMEOUT_MILLISECONDS || 0,
dynamodbGsiTimeoutMilliseconds: process.env.DYNAMODB_GSI_TIMEOUT_MILLISECONDS || 0,
consumerApiKeys: loadConsumerKeys()
});

Expand Down
7 changes: 6 additions & 1 deletion src/services/transfer/transfer-out-ehr-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { logError, logInfo, logWarning } from '../../middleware/logging';
import { getEhrCoreAndFragmentIdsFromRepo } from '../ehr-repo/get-ehr';
import { setCurrentSpanAttributes } from '../../config/tracing';
import { config } from '../../config';
import { parseMessageId } from '../parser/parsing-utilities';
import { sendCore } from '../gp2gp/send-core';
import {
Expand Down Expand Up @@ -36,7 +37,7 @@ export async function transferOutEhrCore({
try {
if (await isEhrRequestDuplicate(outboundConversationId)) return;
await createOutboundConversation(outboundConversationId, nhsNumber, odsCode);

await sleep(config.dynamodbGsiTimeoutMilliseconds);
if (!(await patientAndPracticeOdsCodesMatch(nhsNumber, odsCode))) {
// TODO PRMP-523 when implementing this NACK - I do not think we should update the conversation status here
await updateConversationStatus(
Expand Down Expand Up @@ -173,3 +174,7 @@ const handleCoreTransferError = async (
});
}
};

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
7 changes: 6 additions & 1 deletion terraform/ecs_task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ locals {
{ name = "LOG_LEVEL", value = var.log_level },
{ name = "SQS_EHR_OUT_INCOMING_QUEUE_URL", value = aws_sqs_queue.service_incoming.id },
{ name = "FRAGMENT_TRANSFER_RATE_LIMIT_TIMEOUT_MILLISECONDS", value = "100" },
{ name = "DYNAMODB_NAME", value = data.aws_ssm_parameter.dynamodb_name.value }
{ name = "DYNAMODB_NAME", value = data.aws_ssm_parameter.dynamodb_name.value },
{ name = "DYNAMODB_GSI_TIMEOUT_MILLISECONDS", value = data.aws_ssm_parameter.dynamodb_gsi_timeout_milliseconds.value }
]
secret_environment_variables = [
{ name = "GP2GP_MESSENGER_AUTHORIZATION_KEYS",
Expand Down Expand Up @@ -209,3 +210,7 @@ data "aws_ssm_parameter" "service-to-ehr-repo-sg-id" {
data "aws_ssm_parameter" "dynamodb_prefix_list_id" {
name = "/repo/${var.environment}/output/prm-deductions-infra/dynamodb_prefix_list_id"
}

data "aws_ssm_parameter" "dynamodb_gsi_timeout_milliseconds" {
name = "/repo/${var.environment}/output/prm-repo-ehr-out-service/dynamodb_gsi_timeout_milliseconds"
}
Loading