Skip to content

Commit 42c60c2

Browse files
committed
[Feat] warm up 추가
1 parent 263276e commit 42c60c2

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/modules/app/app.service.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,26 @@ export class AppService implements OnModuleInit {
1717
async warmUpServer() {
1818
console.log('Running warm-up tasks...');
1919

20-
// API 주소들을 호출
20+
const requestBody = {
21+
userRequest: {
22+
user: {
23+
id: '74f7e7ab2bf19e63bb1ec845b760631259d7615440a2d3db7b344ac48ed1bbcde5',
24+
},
25+
},
26+
action: {
27+
clientExtra: {
28+
sys_campus_id: '1',
29+
},
30+
params: {},
31+
detailParams: {},
32+
},
33+
};
34+
2135
try {
22-
await this.callApi('/api/node/user/get/campus');
23-
await this.callApi('/api/node/user/get/college');
24-
await this.callApi('/api/node/user/get/department');
25-
await this.callApi('/api/node/user/update/department');
26-
await this.callApi('/api/node/user/get/profile');
27-
await this.callApi('/api/node/clicker/get/campus');
28-
await this.callApi('/api/node/clicker/get/reading-room');
29-
await this.callApi('/api/node/clicker/get/reading-room-detail');
30-
await this.callApi('/api/node/news/get/news');
36+
await this.callApi('/api/node/user/get/campus', requestBody);
37+
await this.callApi('/api/node/user/get/profile', requestBody);
38+
await this.callApi('/api/node/clicker/get/campus', requestBody);
39+
await this.callApi('/api/node/news/get/news', requestBody);
3140

3241
console.log('All API calls are completed for warm-up.');
3342
} catch (error) {
@@ -36,12 +45,12 @@ export class AppService implements OnModuleInit {
3645
}
3746

3847
// HTTP 요청을 보낼 함수
39-
private async callApi(apiUrl: string) {
48+
private async callApi(apiUrl: string, body: any) {
4049
const baseUrl = 'https://connectgnu.kro.kr';
4150

4251
try {
4352
const response = await firstValueFrom(
44-
this.httpService.post(`${baseUrl}${apiUrl}`),
53+
this.httpService.post(`${baseUrl}${apiUrl}`, body),
4554
);
4655
console.log(`${apiUrl} data fetched successfully`);
4756
} catch (error) {

0 commit comments

Comments
 (0)