-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Context
This issue tracks a refactoring opportunity identified during PR #97 review.
File: src/SportsData.Provider/Application/Processors/ResourceIndexItemProcessor.cs
Problem
The logic for building and publishing DocumentCreated events is duplicated across three methods:
PublishDocumentCreatedAsync(lines 311-346)HandleNewDocumentAsync(lines 227-255)HandleUpdatedDocumentAsync(lines 279-308)
Each method repeats:
baseUrl+providerRefconstructionGetIncludableJsoncallDocumentCreatedinstantiation with identical parameters_publisher.Publishinvocation- Follow-up log message
This duplication creates a maintenance burden—any change to the event construction (e.g., adding a field) must be applied in three places.
Proposed Solution
Extract a single shared helper method that:
- Takes the JSON source string and a log suffix as parameters
- Centralizes the baseUrl/providerRef construction
- Handles the DocumentCreated event instantiation
- Publishes the event
- Logs the completion
Then update the three existing methods to call this shared helper.
References
- PR: enable use of mongo for doc cache #97
- Discussion: enable use of mongo for doc cache #97 (comment)
- Requested by: @jrandallsexton
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels