Closed sandeep-ps closed 1 month ago
@sandeep-ps Sorry for the delay. I ran into a bug where some of the widgets were not loading data because a call to get_dashboard() was returning cached data as a dict
instead of as a DashboardSummary
which was causing things to crash. As best as I can tell the current version of fastapi_cache doesn't preserve pydantic models, so I'm just re-defining the dict that was breaking things as a DashboardSummary
when that issue arises. There may be a more elegant way to keep the model that I'm missing, but I think this will do for now.
I'm going to hold off on merging the pull request until it can be deployed on dev for testing, but I've approved the changes, so please go ahead and make the changes you need to the config/argocd, and we can move forward from there.
Okay. No issues. I will take a look as well.
Hi, Deren, I have gone through your changes. The changes you pushed seems a reasonable fix for now. I just reformatted file and fixed couple of minor typos in the comment. I am pushing the changes now.
Hey @sandeep-ps I think I've got the connection with Redis properly working now. Please take a look and make sure its behaving as you expect.
Please look at the README changes for instructions about running the backend. Please share if anything needs to be added to the instructions.
If you are testing the caching functionality using Postman or any similar software, you can see details about the cache in the response headers :
cache-control
displays the maximum time left before the cached response expires.x-torchlite-cache
indicates whether the request is served from the cache (HIT) or not (MISS). The latter value indicates that the response is not found in the cache and is being added to it.If Redis runs locally in your machine (outside Docker), you can use Redis Insight software to view the cached data (keys and values). All TORCHLITE keys have the prefix
torchlite-cache
.Screenshot:
If Redis is running within Docker (when you are using
docker compose up
), you can go to a Redis docker container terminal and run the following commands to see the keys and their values:If there is at least one entry in the TORCHLITE cache, the output should be one or more key names like:
torchlite-cache::515bbxxxxxxxxyyyyyyyyyzzzzzzzz
.You can see the value stored in a Redis key using the following command.