// AS-IS const dailyCalorieRepository = AppDataSource.getRepository(DailyCalorie); await transactionRunner(async (queryRunner) => { const bmiRepo = dailyCalorieRepository.create({ carbohydrate: carbohydrate, protein: protein, lipid: lipid, calorie: calorie, bmiId: foundBodyMassIndex.id, foods: foods, }); await queryRunner.manager.save(bmiRepo); }); //TO-BE await transactionRunner(async (queryRun..
분류 전체보기
문제 docker-compose로 로컬에서 한번에 띄우고 있는데 위같은 에러가 떴다. 서버가 띄워졌는데, app(express.js 로 이루어짐) 서버가 띄워지는데까지 너무 오래걸려서 redis 서버가 기다리다가 connection timeout을 내뱉은 것이다. 해결방법 1 import * as redis from 'redis'; const redisClient = redis.createClient({ legacyMode: true, username: selectedConfig.username, password: selectedConfig.password, socket: { host: selectedConfig.host, port: selectedConfig.port, connectTimeout: 50..
elasticsearch - kibana 연동해 apm tool로 사용하는 방법을 기록하고자 한다. 우선 첫번째로 elasticsearch를 local에서 사용하는 방법을 정리하고자 한다. 참고로 나의 아키텍쳐는 mac m1 arm64이다. 1. elasticsearch 설치 & 기본세팅 https://www.elastic.co/kr/downloads/past-releases Past Releases of Elastic Stack Software Looking for a past release of Elasticsearch, Logstash, Kibana, es-hadoop, Shield, Marvel, or our language clients? You're in the right place.... w..
(node:31) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [Bus]. Use emitter.setMaxListeners() to increase limit 2023-12-20 20:05:28 (Use `node --trace-warnings ...` to show where the warning was created) 위같은 경고가 떴다. 원인 1. 메모리 관리를 못해서 필요하다는 경고 2. 외부 서비스 붙일 때, 이벤트 리스너를 추가하게 되는데 너무 많이 붙이면 경고 발생 가능함. Node.js에서 Redis, MySQL, RabbitMQ와 같은 외부 서비스를 사용..
코드를 작성한 것들 중에 async/await을 남발해서 동기적으로 작동하게 되어 코드가 비효율적으로 동작한다는 것을 알게되었다. 그래서 리팩토링 하고자 한다. 1. 기존코드 export const dailyCalorieService = async ({ foods, userId }: IUserDailyCalorieService) => { const userRepository = AppDataSource.getRepository(User); const foundUser = await userRepository.findOne({ where: { id: userId } }); const bodyMassIndexRepository = AppDataSource.getRepository(BodyMassIndex);..
0. 기존코드 // regex.ts export const registerRegexesOfType = { email: { regexes: [/^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}$/], msg: '이메일의 형식에 맞게 입력해주세요.', }, password: { regexes: [/^(((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]))|((?=.*\d)(?=.*[a-z]))|((?=.*\d)(?=.*[A-Z]))).{6,15}$/], msg: '비밀번호는 6자 이상 15자 이하의 영문+숫자이어야 합니다.', }, phone: { regexes: [/^01\d\d{3,4}\d{4}$/], msg:..
0. 기존코드 export const bmiTypeCalculation = (height: number, weight: number): string => { const currentBMI = weight / ((height / 100) * (height / 100)); let bmiType: string; if (currentBMI = 15 && currentBMI = 20 && currentBMI < 24.99) { bmiType = 'normal'; } else { bmiType = 'fat'; } return..
1. S3 접두사 설정 키 접두사는 (객체 이름 앞)의 전체 경로를 사용(버킷 이름 포함)할 가 될 수 있는 문자열이다. 접두사의 길이는 객체 키 이름의 최대 길이(1,024바이트)까지 지정할 수 있다. 접두사를 디렉터리와 유사한 방식으로 데이터를 구성하는 방법으로 생각할 수 있다. 그러나 접두사는 디렉터리(폴더)가 아니다. 폴더의 경우 "/" 문자는 다음 하위 폴더 또는 객체 이름을 나타낸다. 접두사의 경우 “/”는 단지 또 하나의 문자에 불과하므로 “/”는 파티션 배치를 나타내지 않는다. 접두사로 검색하면 지정된 접두사로 시작하는 키로만 결과가 제한된다. 구분 기호를 사용하면 목록 작업이 공통 접두사를 공유하는 모든 키를 단일 요약 목록 결과로 롤업한다. 그래서 계층 구조의 포함된 모든 수준을 연결하..