-
Notifications
You must be signed in to change notification settings - Fork 1
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
Correct serviceOwner for legacy #503
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
src/Altinn.Correspondence.Application/GetCorespondences/LegacyGetCorrespondencesHandler.cs (1)
87-130
: Consider parallel processing for party lookups.The current implementation performs sequential lookups for senders, resource owners, and recipients. This could be optimized by running these lookups in parallel using
Task.WhenAll()
.Example refactoring:
var lookupTasks = await Task.WhenAll( GetSenderDetails(correspondences.Item1.Select(c => c.Sender).Distinct()), GetResourceOwnerDetails(correspondences.Item1.Select(c => c.ResourceId).Distinct()), GetRecipientDetails(correspondences.Item1.Select(c => c.Recipient).Distinct()) ); var (Senders, resourceOwners, recipientDetails) = (lookupTasks[0], lookupTasks[1], lookupTasks[2]); private async Task<List<PartyInfo>> GetSenderDetails(IEnumerable<string> orgNrs) { var results = new List<PartyInfo>(); foreach (var orgNr in orgNrs) { try { var party = await _altinnRegisterService.LookUpPartyById(orgNr, cancellationToken); results.Add(new PartyInfo(orgNr, party)); } catch (Exception e) { _logger.LogError(e, "Failed to lookup sender party for orgNr: {OrgNr}", orgNr); results.Add(new PartyInfo(orgNr, null)); } } return results; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/Altinn.Correspondence.Application/GetCorespondences/LegacyGetCorrespondencesHandler.cs
(4 hunks)
🔇 Additional comments (3)
src/Altinn.Correspondence.Application/GetCorespondences/LegacyGetCorrespondencesHandler.cs (3)
23-23
: LGTM! Good refactoring of the record type.
The rename from ResourceOwner
to PartyInfo
and the change from OrgNumber
to Id
makes the type more generic and reusable across different contexts.
101-116
: LGTM! Good error handling for resource owner lookups.
The implementation includes proper error handling with informative logging messages, making it easier to diagnose issues in production.
117-130
: LGTM! Good error handling for recipient lookups.
The implementation includes proper error handling with informative logging messages, similar to the resource owner lookups.
Description
Now uses correct service owner for legacy correspondences.
MessageSender = messageSender, with fallback on names for Sender¨
ServiceOwner = name of the ServiceOwner
Verification
Documentation
Summary by CodeRabbit
New Features
PartyInfo
structure, improving clarity in correspondence management.Bug Fixes