⚡ Bolt: Optimize trailer lookup I/O#9
Conversation
Optimizes the `GetTrailerInfo` endpoint by skipping file system operations when no trailer is found, unless debug logging is explicitly enabled. This prevents unnecessary I/O overhead for users who do not have trailers for all their media items.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
💡 What:
Wrapped the "potential trailer files" detection logic in
GetTrailerInfowith a check forPlugin.Instance.Configuration.EnableDebugLogging.🎯 Why:
Previously, when a user requested trailer info for a movie that didn't have one, the server would unconditionally scan the movie's directory for files to log potential mismatches. This involves synchronous I/O operations (
Directory.GetFiles) which are expensive and unnecessary for normal operation, especially when browsing libraries with many items lacking trailers.📊 Impact:
Eliminates disk I/O for "trailer not found" cases when debug logging is disabled (default). This reduces latency and disk usage.
🔬 Measurement:
Verified by code analysis. The logic inside the
ifblock performs I/O operations solely for the purpose of callingLoggingHelper.LogDebug. If debug logging is disabled, these logs are discarded anyway, making the I/O work completely redundant. The change ensures this work is skipped entirely.PR created automatically by Jules for task 13727270288210195685 started by @Fovty