Skip to content

Commit 1aa5975

Browse files
authored
Merge pull request #2789 from humanprotocol/develop
Release 20241114
2 parents 78f39fa + d8f0dab commit 1aa5975

File tree

516 files changed

+9061
-16197
lines changed

Some content is hidden

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

516 files changed

+9061
-16197
lines changed

.github/workflows/ci-test-dashboard-ui.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/ci-test-faucet-server.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
paths:
99
- 'packages/core/**'
1010
- 'packages/sdk/typescript/human-protocol-sdk/**'
11-
- 'packages/apps/faucet-server/**'
11+
- 'packages/apps/faucet/server/**'
1212
workflow_dispatch:
1313

1414
jobs:
@@ -21,6 +21,6 @@ jobs:
2121
name: Install dependencies
2222
- run: cp .env.example .env
2323
name: Create .env file
24-
working-directory: packages/apps/faucet-server
24+
working-directory: packages/apps/faucet/server
2525
- run: yarn workspace @human-protocol/faucet-server test
26-
name: Run faucet-server test
26+
name: Run faucet/server test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"scripts": {
99
"test": "concurrently \"yarn workspace @human-protocol/core test\" \"yarn workspace @human-protocol/sdk test\" \"yarn workspace @human-protocol/subgraph test\" \"yarn workspace @human-protocol/dashboard-ui test\" \"yarn workspace @human-protocol/faucet-server test\" \"yarn workspace @human-protocol/job-launcher-server test\" \"yarn workspace @human-protocol/job-launcher-client test\" \"yarn workspace @human-protocol/human-app-frontend test\" \"yarn workspace @human-protocol/human-app-server test\" \"yarn workspace @human-protocol/reputation-oracle test\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server test\" \"yarn workspace @human-protocol/fortune-recording-oracle test\"",
10-
"lint": "concurrently \"yarn workspace @human-protocol/core lint\" \"yarn workspace @human-protocol/sdk lint\" \"yarn workspace @human-protocol/subgraph lint\" \"yarn workspace @human-protocol/dashboard-ui lint\" \"yarn workspace @human-protocol/faucet-server lint\" \"yarn workspace @human-protocol/job-launcher-server lint\" \"yarn workspace @human-protocol/job-launcher-client lint\" \"yarn workspace @human-protocol/human-app-frontend lint\" \"yarn workspace @human-protocol/human-app-server lint\" \"yarn workspace @human-protocol/reputation-oracle lint\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server lint\" \"yarn workspace @human-protocol/fortune-recording-oracle lint\"",
10+
"lint": "concurrently \"yarn workspace @human-protocol/core lint\" \"yarn workspace @human-protocol/sdk lint\" \"yarn workspace @human-protocol/subgraph lint\" \"yarn workspace @human-protocol/faucet-client lint\" \"yarn workspace @human-protocol/faucet-server lint\" \"yarn workspace @human-protocol/job-launcher-server lint\" \"yarn workspace @human-protocol/job-launcher-client lint\" \"yarn workspace @human-protocol/human-app-frontend lint\" \"yarn workspace @human-protocol/human-app-server lint\" \"yarn workspace @human-protocol/reputation-oracle lint\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server lint\" \"yarn workspace @human-protocol/fortune-recording-oracle lint\"",
1111
"prepare": "husky",
1212
"postinstall": "yarn workspace @human-protocol/sdk build"
1313
},

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/dashboard/ui-2024/.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"semi": true,
44
"singleQuote": true,
55
"tabWidth": 2,
6-
"useTabs": true,
6+
"useTabs": false,
77
"endOfLine": "lf"
88
}

0 commit comments

Comments
 (0)