Skip to content

Commit 13aca73

Browse files
authored
Merge pull request #600 from NHSDigital/feature/ELI-686-adding-subsegments
[ELI-686] - removing decorator as does not work with generators
2 parents c2ca492 + d859479 commit 13aca73

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/eligibility_signposting_api/repos/campaign_repo.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def __init__(
2626
self.s3_client = s3_client
2727
self.bucket_name = bucket_name
2828

29-
@xray_recorder.capture("CampaignRepo.get_campaign_configs") # pyright: ignore[reportCallIssue]
3029
def get_campaign_configs(self) -> Generator[CampaignConfig]:
31-
with xray_recorder.in_subsegment("CampaignRepo.get_campaign_configs:list_objects"):
32-
campaign_objects = self.s3_client.list_objects(Bucket=self.bucket_name)
33-
with xray_recorder.in_subsegment("CampaignRepo.get_campaign_configs:get_objects"):
34-
for campaign_object in campaign_objects["Contents"]:
35-
response = self.s3_client.get_object(Bucket=self.bucket_name, Key=f"{campaign_object['Key']}")
36-
body = response["Body"].read()
37-
yield Rules.model_validate(json.loads(body)).campaign_config
30+
with xray_recorder.in_subsegment("CampaignRepo.get_campaign_configs"):
31+
with xray_recorder.in_subsegment("list_objects"):
32+
campaign_objects = self.s3_client.list_objects(Bucket=self.bucket_name)
33+
with xray_recorder.in_subsegment("get_objects"):
34+
for campaign_object in campaign_objects["Contents"]:
35+
response = self.s3_client.get_object(Bucket=self.bucket_name, Key=f"{campaign_object['Key']}")
36+
body = response["Body"].read()
37+
yield Rules.model_validate(json.loads(body)).campaign_config

0 commit comments

Comments
 (0)