Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add cache cleaner #66

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

chore: add cache cleaner #66

wants to merge 2 commits into from

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jun 4, 2023

🧿 Current issues / What's wrong ?

There is now way to delete all cached contents, in case there was an issue, producing bugged cached contents.

💊 Fixes / Solution

Add a dev script to manually trigger cache clearing. Script only for dev use, and can not be run on prod.

🚧 Changes

  • Add script to list the contents of the cache
  • Add script to clear the whole cache

🛠️ Tests

To be run only on your locally configured dev storage engine. Do not test with prod settings in your .env or you will wipe the prod cache

Recommend to set your storage engine to file, and add some dummy files to tmp/votes.

  • yarn ts-node scripts/list-cache.ts to list the cache contents
  • yarn ts-node scripts/clear-cache.ts to clear the cache

@wa0x6e wa0x6e changed the title chore add cache cleaner chore: add cache cleaner Jun 4, 2023
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we save wrong cached data? This is just for development, in that case, we can easily modify the folder name with VOTE_REPORT_SUBDIR env right?

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jun 21, 2023

Why do we save wrong cached data? This is just for development, in that case, we can easily modify the folder name with VOTE_REPORT_SUBDIR env right?

It’s for rare cases, when the cached data are wrong, like some edge cases we did not foreseen.

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jun 21, 2023

Either way, the function to delete files is not wasted, and will be reused in #80

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jun 21, 2023

And in cases where cached files contains error, even if we change the cache dir, we still need to clear those files to reduce cost

@ChaituVR
Copy link
Member

I feel like it is very easy to delete/rename files on AWS/DO spaces. can merge this but just worried about the unwanted code 🙈

@ChaituVR
Copy link
Member

example
image

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jun 21, 2023

I feel like it is very easy to delete/rename files on AWS/DO spaces. can merge this but just worried about the unwanted code 🙈

You can, when you have access 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants