def serve(port: int = 50055):
"""
gRPC 서버를 시작하는 함수
Args:
port: 서버가 리스닝할 포트 번호 (기본값: 50055)
"""
# ThreadPoolExecutor를 사용하여 최대 10개의 워커 스레드로 요청 처리
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
# SummaryServiceServicer 인스턴스를 서버에 등록
agents_pb2_grpc.add_SummaryServiceServicer_to_server(SummaryServiceServicer(), server)
# IPv6 모든 인터페이스([::])에 지정된 포트로 바인딩
server.add_insecure_port(f"[::]:{port}")
# 서버 시작 로그 출력
print(f"[SummaryService] gRPC server listening on {port}")
# 서버 시작
server.start()
# 서버가 종료될 때까지 대기
server.wait_for_termination()