Skip to content

Commit

Permalink
feat: Support cachePrivatePackages for GitHub GraphQL tags and rele…
Browse files Browse the repository at this point in the history
…ases (#30123)
  • Loading branch information
zharinov committed Jul 10, 2024
1 parent b4849b6 commit 650ac22
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/util/github/graphql/datasource-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AggregateError from 'aggregate-error';
import { GlobalConfig } from '../../../config/global';
import { logger } from '../../../logger';
import { ExternalHostError } from '../../../types/errors/external-host-error';
import * as memCache from '../../cache/memory';
Expand Down Expand Up @@ -226,9 +227,14 @@ export class GithubGraphqlDatasourceFetcher<
}
const cacheNs = this.getCacheNs();
const cacheKey = this.getCacheKey();
this._cacheStrategy = this.isPersistent
? new GithubGraphqlPackageCacheStrategy<ResultItem>(cacheNs, cacheKey)
: new GithubGraphqlMemoryCacheStrategy<ResultItem>(cacheNs, cacheKey);
const cachePrivatePackages = GlobalConfig.get(
'cachePrivatePackages',
false,
);
this._cacheStrategy =
cachePrivatePackages || this.isPersistent
? new GithubGraphqlPackageCacheStrategy<ResultItem>(cacheNs, cacheKey)
: new GithubGraphqlMemoryCacheStrategy<ResultItem>(cacheNs, cacheKey);
return this._cacheStrategy;
}

Expand Down

0 comments on commit 650ac22

Please sign in to comment.