feat: info resolver refactor#1594
Conversation
…r system metrics - Introduced new types for `ContainerPort`, `CpuLoad`, `MemoryUtilization`, and `InfoDisplay` to expand system metrics capabilities. - Added subscriptions for `systemMetricsCpu` and `systemMetricsMemory` to provide real-time updates on CPU and memory utilization. - Refactored existing resolvers to utilize the new types and improve data handling. - Consolidated imports and removed deprecated services to streamline the codebase. - Updated tests to cover new functionality and ensure reliability.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @elibosley's task —— View job Code Review ProgressAnalyzing the diff for critical issues in the info resolver refactor changes:
Review Results✅ No critical issues found in changes This is a well-structured refactor that breaks down a monolithic info resolver into modular services. Key observations from the diff analysis: What was changed:
Security & Safety:
API Compatibility:
The refactor follows good practices with proper error handling, modular design, and maintains API compatibility. |
…otherboard information - Reintroduced `InfoSystem` and `InfoBaseboard` types in the GraphQL schema with additional fields for memory capacity and slots. - Updated the `CachedResolverBase` to improve promise caching and data merging logic, ensuring thread-safe operations. - Added comprehensive unit tests for `CachedResolverBase` to validate caching behavior, error handling, and concurrent access scenarios. - Enhanced memory management with WeakMap to prevent memory leaks during data fetching. - Cleaned up promise cache key handling to avoid data corruption during concurrent resolver access.
- Changed the type declaration of `parent` from an empty object to `any` in two test cases within `CachedResolverBase` to improve type safety and clarity in the tests.
…lverBase - Removed the data lock mechanism to streamline the promise caching process. - Enhanced the data merging logic to directly merge fetched data into the parent object, improving performance and reducing complexity. - Ensured thread-safe operations by leveraging the promise itself for concurrency handling.
pujitm
left a comment
There was a problem hiding this comment.
generally looks good, just some thoughts & q's
api/src/unraid-api/graph/resolvers/info/versions/versions.resolver.ts
Outdated
Show resolved
Hide resolved
- Added a new `Metrics` type to the GraphQL schema to encapsulate CPU and memory utilization metrics. - Implemented `MetricsResolver` to handle queries and subscriptions for real-time CPU and memory data. - Updated existing resolvers to remove deprecated fields and improve data handling. - Enhanced the GraphQL query structure to include the new `metrics` field for accessing system metrics. - Added integration and unit tests to ensure the reliability of the new metrics functionality.
…ation metrics - Reintroduced the `Metrics` type in the GraphQL schema to include CPU and memory utilization metrics. - Modified the calculation of `usedPercent` in the `MemoryService` to accurately reflect memory usage based on available and total memory. - Removed deprecated `Metrics` type definition from the schema to streamline the codebase.
- Updated the `usedPercent` calculation in the `MemoryService` to handle cases where total memory is zero, preventing potential division by zero errors and ensuring accurate memory utilization metrics.
- Updated the integration test for `InfoResolver` to skip the versions data test when running in a CI environment, ensuring compatibility and preventing potential failures during automated testing.
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
No description provided.