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

Expire cache periodically to avoid unbounded size #466

Merged
merged 2 commits into from May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions dist/post_run/index.js
Expand Up @@ -66447,11 +66447,9 @@ const getIntervalKey = (invalidationIntervalDays) => {
function buildCacheKeys() {
return __awaiter(this, void 0, void 0, function* () {
const keys = [];
let cacheKey = `golangci-lint.cache-`;
keys.push(cacheKey);
// Periodically invalidate a cache because a new code being added.
// TODO: configure it via inputs.
cacheKey += `${getIntervalKey(7)}-`;
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`;
keys.push(cacheKey);
if (yield pathExists(`go.mod`)) {
// Add checksum to key to invalidate a cache when dependencies change.
Expand Down
4 changes: 1 addition & 3 deletions dist/run/index.js
Expand Up @@ -66447,11 +66447,9 @@ const getIntervalKey = (invalidationIntervalDays) => {
function buildCacheKeys() {
return __awaiter(this, void 0, void 0, function* () {
const keys = [];
let cacheKey = `golangci-lint.cache-`;
keys.push(cacheKey);
// Periodically invalidate a cache because a new code being added.
// TODO: configure it via inputs.
cacheKey += `${getIntervalKey(7)}-`;
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`;
keys.push(cacheKey);
if (yield pathExists(`go.mod`)) {
// Add checksum to key to invalidate a cache when dependencies change.
Expand Down
5 changes: 1 addition & 4 deletions src/cache.ts
Expand Up @@ -52,12 +52,9 @@ const getIntervalKey = (invalidationIntervalDays: number): string => {

async function buildCacheKeys(): Promise<string[]> {
const keys = []
let cacheKey = `golangci-lint.cache-`
keys.push(cacheKey)

// Periodically invalidate a cache because a new code being added.
// TODO: configure it via inputs.
cacheKey += `${getIntervalKey(7)}-`
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`
keys.push(cacheKey)

if (await pathExists(`go.mod`)) {
Expand Down