- Added new environment variables for Salesforce event channels and Change Data Capture (CDC) to improve cache invalidation and event handling. - Updated Salesforce module to include new guards for write operations, enhancing request rate limiting. - Refactored various services to utilize caching for improved performance and reduced API calls, including updates to the Orders and Catalog modules. - Enhanced error handling and logging in Salesforce services to provide better insights during operations. - Improved cache TTL configurations for better memory management and data freshness across catalog and order services.
29 lines
781 B
TypeScript
29 lines
781 B
TypeScript
import { Controller, Get } from "@nestjs/common";
|
|
import { CatalogCacheService, CatalogCacheSnapshot } from "./services/catalog-cache.service";
|
|
|
|
interface CatalogCacheHealthResponse {
|
|
timestamp: string;
|
|
metrics: CatalogCacheSnapshot;
|
|
ttl: {
|
|
catalogSeconds: number | null;
|
|
eligibilitySeconds: number | null;
|
|
staticSeconds: number | null;
|
|
volatileSeconds: number;
|
|
};
|
|
}
|
|
|
|
@Controller("health/catalog")
|
|
export class CatalogHealthController {
|
|
constructor(private readonly catalogCache: CatalogCacheService) {}
|
|
|
|
@Get("cache")
|
|
getCacheMetrics(): CatalogCacheHealthResponse {
|
|
const ttl = this.catalogCache.getTtlConfiguration();
|
|
return {
|
|
timestamp: new Date().toISOString(),
|
|
metrics: this.catalogCache.getMetrics(),
|
|
ttl,
|
|
};
|
|
}
|
|
}
|