Skip to content

Commit 68e9190

Browse files
committed
Resolve conflicts
2 parents e2cd19e + be1435d commit 68e9190

File tree

55 files changed

+609
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+609
-452
lines changed

packages/apps/dashboard/server/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616
},
1717
"dependencies": {
1818
"@human-protocol/sdk": "*",
19-
"@nestjs/axios": "^3.0.2",
19+
"@nestjs/axios": "^3.1.2",
2020
"@nestjs/cache-manager": "^2.2.2",
2121
"@nestjs/common": "^10.2.7",
2222
"@nestjs/config": "^3.2.3",
2323
"@nestjs/core": "^10.2.8",
2424
"@nestjs/mapped-types": "*",
2525
"@nestjs/platform-express": "^10.3.10",
26-
"cache-manager-redis-store": "^3.0.1",
26+
"cache-manager": "^5.4.0",
27+
"cache-manager-redis-yet": "^5.1.5",
2728
"dayjs": "^1.11.12",
29+
"lodash": "^4.17.21",
2830
"reflect-metadata": "^0.2.2",
2931
"rxjs": "^7.2.0"
3032
},

packages/apps/dashboard/server/src/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ import { StatsModule } from './modules/stats/stats.module';
2121
validationSchema: Joi.object({
2222
HOST: Joi.string().required(),
2323
PORT: Joi.number().port().default(3000),
24+
REDIS_HOST: Joi.string(),
25+
REDIS_PORT: Joi.number(),
2426
SUBGRAPH_API_KEY: Joi.string().required(),
2527
HCAPTCHA_API_KEY: Joi.string().required(),
28+
CACHE_HMT_PRICE_TTL: Joi.number(),
29+
CACHE_HMT_GENERAL_STATS_TTL: Joi.number(),
2630
}),
2731
}),
2832
CacheModule.registerAsync(CacheFactoryConfig),

packages/apps/dashboard/server/src/common/config/cache-factory.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import { CacheModuleAsyncOptions } from '@nestjs/common/cache';
22
import { ConfigModule } from '@nestjs/config';
3+
import * as _ from 'lodash';
34
import { RedisConfigService } from './redis-config.service';
4-
import { redisStore } from 'cache-manager-redis-store';
5+
import { redisStore } from 'cache-manager-redis-yet';
6+
import { Logger } from '@nestjs/common';
7+
8+
const logger = new Logger('CacheFactoryRedisStore');
9+
10+
const throttledRedisErrorLog = _.throttle((error) => {
11+
logger.error('Redis client network error', error);
12+
}, 1000 * 5);
513

614
export const CacheFactoryConfig: CacheModuleAsyncOptions = {
715
isGlobal: true,
@@ -12,7 +20,11 @@ export const CacheFactoryConfig: CacheModuleAsyncOptions = {
1220
host: configService.redisHost,
1321
port: configService.redisPort,
1422
},
23+
disableOfflineQueue: true,
1524
});
25+
26+
store.client.on('error', throttledRedisErrorLog);
27+
1628
return {
1729
store: () => store,
1830
};

packages/apps/dashboard/server/src/common/config/redis-config.service.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,22 @@ export class RedisConfigService {
1717
return this.configService.get<string>('REDIS_HOST', DEFAULT_REDIS_HOST);
1818
}
1919
get redisPort(): number {
20-
return +this.configService.get<number>('REDIS_PORT', DEFAULT_REDIS_PORT);
20+
return this.configService.get<number>('REDIS_PORT', DEFAULT_REDIS_PORT);
2121
}
2222
get cacheHmtPriceTTL(): number {
23-
return +this.configService.get<number>(
24-
'CACHE_HMT_PRICE_TTL',
25-
DEFAULT_CACHE_HMT_PRICE_TTL,
23+
return (
24+
this.configService.get<number>(
25+
'CACHE_HMT_PRICE_TTL',
26+
DEFAULT_CACHE_HMT_PRICE_TTL,
27+
) * 1000
2628
);
2729
}
2830
get cacheHmtGeneralStatsTTL(): number {
29-
return +this.configService.get<number>(
30-
'CACHE_HMT_GENERAL_STATS_TTL',
31-
DEFAULT_CACHE_HMT_GENERAL_STATS_TTL,
31+
return (
32+
this.configService.get<number>(
33+
'CACHE_HMT_GENERAL_STATS_TTL',
34+
DEFAULT_CACHE_HMT_GENERAL_STATS_TTL,
35+
) * 1000
3236
);
3337
}
3438
get hmtPriceCacheKey(): string {

packages/apps/dashboard/server/src/modules/stats/stats.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Inject, Injectable, Logger, OnModuleInit } from '@nestjs/common';
22
import { HttpService } from '@nestjs/axios';
33
import { lastValueFrom } from 'rxjs';
4-
import * as dayjs from 'dayjs';
4+
import dayjs from 'dayjs';
55
import { Cron } from '@nestjs/schedule';
66
import { Cache, CACHE_MANAGER } from '@nestjs/cache-manager';
77
import { NETWORKS, StatisticsClient } from '@human-protocol/sdk';
@@ -322,7 +322,7 @@ export class StatsService implements OnModuleInit {
322322
await this.cacheManager.set(
323323
this.redisConfigService.hmtPriceCacheKey,
324324
hmtPrice,
325-
{ ttl: this.redisConfigService.cacheHmtPriceTTL } as any,
325+
this.redisConfigService.cacheHmtPriceTTL,
326326
);
327327
return hmtPrice;
328328
}

packages/apps/dashboard/server/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"noImplicitAny": false,
1717
"strictBindCallApply": false,
1818
"forceConsistentCasingInFileNames": false,
19-
"noFallthroughCasesInSwitch": false
19+
"noFallthroughCasesInSwitch": false,
20+
"esModuleInterop": true
2021
}
2122
}

packages/apps/fortune/exchange-oracle/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"dependencies": {
3131
"@human-protocol/sdk": "*",
32-
"@nestjs/axios": "^3.0.2",
32+
"@nestjs/axios": "^3.1.2",
3333
"@nestjs/common": "^10.2.7",
3434
"@nestjs/core": "^10.3.10",
3535
"joi": "^17.13.3",

packages/apps/fortune/recording-oracle/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"dependencies": {
2727
"@human-protocol/sdk": "*",
28-
"@nestjs/axios": "^3.0.2",
28+
"@nestjs/axios": "^3.1.2",
2929
"@nestjs/common": "^10.2.7",
3030
"@nestjs/config": "^3.1.1",
3131
"@nestjs/core": "^10.3.10",

packages/apps/human-app/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"zustand": "^4.5.0"
5050
},
5151
"devDependencies": {
52-
"@tanstack/eslint-plugin-query": "^5.18.1",
52+
"@tanstack/eslint-plugin-query": "^5.60.1",
5353
"@tanstack/react-query-devtools": "^5.59.16",
5454
"@testing-library/jest-dom": "^6.5.0",
5555
"@testing-library/react": "^15.0.7",

packages/apps/human-app/frontend/src/api/services/common/get-access-token.ts renamed to packages/apps/human-app/frontend/src/api/services/common/use-access-token-refresh.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { AuthType } from '@/shared/types/browser-auth-provider';
99
import { useWeb3Auth } from '@/auth-web3/use-web3-auth';
1010
import { routerPaths } from '@/router/router-paths';
1111

12-
export function useGetAccessTokenMutation() {
12+
export function useAccessTokenRefresh() {
1313
const queryClient = useQueryClient();
1414
const navigate = useNavigate();
1515
const {
@@ -23,7 +23,7 @@ export function useGetAccessTokenMutation() {
2323
user: web3User,
2424
} = useWeb3Auth();
2525

26-
return useMutation({
26+
const mutation = useMutation({
2727
mutationFn: async ({
2828
authType,
2929
throwExpirationModalOnSignOut = true,
@@ -72,5 +72,13 @@ export function useGetAccessTokenMutation() {
7272
onError: async () => {
7373
await queryClient.invalidateQueries();
7474
},
75+
scope: {
76+
id: 'refresh-access-token',
77+
},
7578
});
79+
80+
return {
81+
refreshAccessToken: mutation.mutate,
82+
refreshAccessTokenAsync: mutation.mutateAsync,
83+
};
7684
}

0 commit comments

Comments
 (0)