-
Notifications
You must be signed in to change notification settings - Fork 0
Fix SDK version and Service Lifetimes #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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -116,20 +116,20 @@ | |||||
| builder.Services.Configure<ApiSettings>(builder.Configuration.GetSection("ApiSettings")); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The line builder.Services.AddOptions<ApiSettings>()
.Bind(builder.Configuration.GetSection("ApiSettings"))
.ValidateDataAnnotations()
.ValidateOnStart();This ensures configuration issues are detected early. |
||||||
|
|
||||||
| // Register core services | ||||||
| builder.Services.AddScoped<ITranslationService, TranslationService>(); | ||||||
| builder.Services.AddScoped<ILyricsService, LyricsService>(); | ||||||
| builder.Services.AddSingleton<ITranslationService, TranslationService>(); | ||||||
| builder.Services.AddSingleton<ILyricsService, LyricsService>(); | ||||||
|
||||||
| builder.Services.AddSingleton<ILyricsService, LyricsService>(); | |
| builder.Services.AddScoped<ILyricsService, LyricsService>(); |
Copilot
AI
Jan 28, 2026
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.
IAudioSynthesisService is now registered as a singleton, but AudioSynthesisService maintains mutable shared state (_accessToken / _tokenExpiry) without any synchronization. Under concurrent requests this can lead to races and redundant token fetches, and (in the worst case) using a stale token for a request. Consider adding an async lock/semaphore around token refresh (or using IMemoryCache with a single-flight pattern) so token acquisition is thread-safe when used as a singleton.
| builder.Services.AddSingleton<IAudioSynthesisService, AudioSynthesisService>(); | |
| builder.Services.AddScoped<IAudioSynthesisService, AudioSynthesisService>(); |
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.
All core, validation, diagnostic, and utility services are registered as singletons. If any of these services maintain state or depend on scoped services (such as HttpContext or per-request data), this can lead to data races or incorrect behavior. Review the implementation of these services to ensure singleton lifetime is appropriate. If any service requires per-request data, consider using AddScoped instead.
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.
global.jsonpins the SDK to10.0.100withrollForward: latestPatch. This setting will NOT roll forward to a different feature band (e.g.,10.0.102), so environments that only have newer10.0.10xSDKs installed will fail with “SDK not found”. To keep builds resilient across dev/CI machines, consider usingrollForward: latestFeature(or updating CI to install10.0.100specifically).