Cleanup the codebase, DRY and abstract functions, increase the test coverage.

This commit is contained in:
2025-02-25 12:53:52 +00:00
parent c721913cbe
commit 7d204113ea
8 changed files with 225 additions and 353 deletions
+2 -1
View File
@@ -35,8 +35,9 @@ func (c *MetadataCache) Cleanup() {
}
}
func (c *MetadataCache) isCacheValid() bool {
return c.metadata != nil && time.Now().Before(c.expiresAt)
return c.metadata != nil && time.Now().Before(c.expiresAt)
}
// GetMetadata retrieves the metadata from cache or fetches it if expired
func (c *MetadataCache) GetMetadata(providerURL string, httpClient *http.Client, logger *Logger) (*ProviderMetadata, error) {
c.mutex.RLock()