Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"cors": "^2.8.6",
"express": "^5.2.1",
"express-basic-auth": "^1.2.1",
"express-rate-limit": "^8.4.1",
"express-rate-limit": "^8.5.0",
"express-validator": "^7.3.2",
"graphql": "^16.13.2",
"graphql-http": "^1.22.4",
Expand Down
11 changes: 10 additions & 1 deletion src/aggregator/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ import GroupConfig from '../models/group-config.js';
import { Config} from '../models/config.js';
import { ConfigStrategy, OperationsType, StrategiesType } from '../models/config-strategy.js';
import Component from '../models/component.js';
import Cache from '../helpers/cache/index.js';
import { getConfigFromCache } from '../services/snapshot-cache.js';

export const resolveConfigByKey = async (domain, key) => Config.findOne({ domain, key }, null, { lean: true });
export async function resolveConfigByKey(domain, key) {
const cache = Cache.getInstance();
if (cache.isEnabled()) {
return getConfigFromCache(cache, domain, key);
}

return Config.findOne({ domain, key }, null, { lean: true });
}

export function resolveEnvValue(source, field, keys) {
const arrValue = [];
Expand Down
4 changes: 4 additions & 0 deletions tests/client-api-cached.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ describe('Testing criteria [GraphQL]', () => {

test('CLIENT_CACHED_SUITE - It will be deactivated on default environment', async () => {
await changeConfigStatus(configId, false, EnvType.DEFAULT);
await Cache.getInstance().refreshDomain(domainId);

const response = await request(app)
.post('/graphql')
.set('Authorization', `Bearer ${token}`)
Expand All @@ -222,6 +224,8 @@ describe('Testing criteria [GraphQL]', () => {
qaToken = responseToken.body.token;

await changeConfigStatus(configId, true, 'QA');
await Cache.getInstance().refreshDomain(domainId);

const response = await request(app)
.post('/graphql')
.set('Authorization', `Bearer ${qaToken}`)
Expand Down