We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
실시간데이터 수신과 반복적인 계좌조회가 multi thread 로 수행될때 gRPC 서버 멈춤 현상을 리포트 합니다. 재현 하실 수 있게 real2.py 를 게시합니다.
from time import sleep from koapy.backend.kiwoom_open_api_plus.grpc.KiwoomOpenApiPlusServiceClient import KiwoomOpenApiPlusServiceClient import threading import random wait=5 evt = threading.Event() def getreal(kiwoom, codes,fids,screenno): global evt stream = kiwoom.GetRealDataForCodesAsStream(codes, fids=fids, screen_no=screenno) for event in stream: if evt.is_set(): stream.cancel() break return def getaccount(kiwoom): global evt while True: s,m=kiwoom.GetAccountEvaluationStatusAsSeriesAndDataFrame(account_no='800409****') print(m) sleep(wait) if evt.is_set(): break return def start_account_thread(kiwoom): t=threading.Thread(target=getaccount, args=(kiwoom,)) t.start() print(f"Account thread started\n") return t def start_real_thread(kiwoom): codes=["252670","005930","122630","302440","111710","293490","323410"] fids=[10,11,12,27,28,16,17,18,26,311] scrno = str(random.randrange(1000,9999)) t=threading.Thread(target=getreal, args=(kiwoom,codes,fids,scrno)) t.start() print(f"Realtime thread started") return t def start(): print("Started") kiwoom = KiwoomOpenApiPlusServiceClient() kiwoom.EnsureConnected() t_account = start_account_thread(kiwoom) t_real = start_real_thread(kiwoom) sleep(600) print('sleep done') evt.set() # 600초 뒤에 모든 Thread에 종료 시그널을 보냅니다. t_account.join() print(f"Account thread terminated\n") t_real.join() print(f"Realtime thread terminated\n") print("Finished") if __name__=="__main__": start()
real2.py 의 동작은 다음과 같습니다.
터미널을 열어 서버를 띄웁니다. koapy version: 0.5.1
koapy serve
real2.py 에서 account_no='800409****' 의 계좌번호를 본인의 것으로 수정합니다. 터미널을 한개 더 띄워서 real2.py 를 실행시킵니다.
python real2.py
처음 1~2분간은 순조롭게 2개 쓰레드가 정상 수행됩니다. 이후 서버가 갑자기 멈추면서 쓰레드 역시 동작을 멈춥니다.
The text was updated successfully, but these errors were encountered:
Fix abnormal hang (#41)
f768065
Add non-blocking rate limiting feature, with much general fix to #41
0ea61ab
0.6.0 버전으로 테스트 부탁드립니다.
Sorry, something went wrong.
이슈 해결된 것 같습니다. 문제 시나리오 이틀간 테스트해봤는데, 서버 응답없는 현상 나타나지 않았습니다. 감사합니다!
문제 해결되서 이슈 닫습니다.
No branches or pull requests
실시간데이터 수신과 반복적인 계좌조회가 multi thread 로 수행될때 gRPC 서버 멈춤 현상을 리포트 합니다.
재현 하실 수 있게 real2.py 를 게시합니다.
real2.py
real2.py 의 동작은 다음과 같습니다.
테스트방법
터미널을 열어 서버를 띄웁니다.
koapy version: 0.5.1
real2.py 에서 account_no='800409****' 의 계좌번호를 본인의 것으로 수정합니다.
터미널을 한개 더 띄워서 real2.py 를 실행시킵니다.
문제현상
처음 1~2분간은 순조롭게 2개 쓰레드가 정상 수행됩니다.
이후 서버가 갑자기 멈추면서 쓰레드 역시 동작을 멈춥니다.
The text was updated successfully, but these errors were encountered: