Green-Software-Foundation / carbon-aware-sdk

Carbon-Aware SDK
https://carbon-aware-sdk.greensoftware.foundation/
MIT License
484 stars 99 forks source link

Add a configuration for disabling to cache JSON emission data #555

Closed YaSuenag closed 2 months ago

YaSuenag commented 3 months ago

Pull Request

Summary

Support dynamic update for emission data JSON file.

It is useful if we can update emission data when we use custom data via JSON datasource. Currently JSON datasource would cache all of data in JSON on memory, so the update would not propagate even if it is updated. We have to restart WebAPI when we need to update emission data. It is not good for system operation.

I want to introduce CacheJsonData into JSON datasource configuration. If the user set it to false, JSON datasource would read emission data JSON file everytime when the request happens. This option is set to true by default, so this PR does not break current behavior.

Changes

Checklist

Are there API Changes?

No

Is this a breaking change?

No