Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.

[이슈] RecursionError: maximum recursion depth exceeded while calling a Python object #21

Closed
cha2hyun opened this issue Aug 5, 2021 · 3 comments
Assignees
Labels
bug Something isn't working 해결: 수정 이슈를 인지하여 코드를 수정하였다

Comments

@cha2hyun
Copy link

cha2hyun commented Aug 5, 2021

재현 절차

  1. 프로그램 돌리기
  2. 잔여백신 생김
  3. 에러발생으로 멈춤

이슈 내용

기대 결과

  1. 리퀘스트를 쓰레드로 전송해도 좋을 것 같아요 (속도개선)

참조

2021-08-05 15:09:29.592544
주소는 : 서울 강남구 테헤란로 119 입니다.
VEN00013 으로 예약을 시도합니다.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '16:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '16:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '16:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
VEN00014 으로 예약을 시도합니다.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '16:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '16:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
VEN00015 으로 예약을 시도합니다.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
VEN00016 으로 예약을 시도합니다.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
{'code': 'NO_VACANCY', 'desc': '잔여백신 접종 신청이\n선착순 마감되었습니다.', 'organization': {'orgCode': '12344427', 'orgName': '영이비인후과의원', 'confirmId': '1440349052', 'phoneNumber': '02-553-2085', 'address': '서울 강남구 테헤란로 119', 'x': 127.0306831919398, 'y': 37.49930653395399, 'openHour': {'date': '2021-08-05', 'dayOfWeek': '목요일', 'dayOff': False, 'openHour': {'start': '10:00', 'end': '17:00'}, 'lunch': {'start': '13:00', 'end': '14:00'}}, 'disabled': False}}
Response Error Occurred.
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Users\kimch\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\kimch\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "qtmain.py", line 128, in
reservation_start = lambda: reservation.start()
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 19, in start
self.find_vaccine("ANY")
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 103, in find_vaccine
self.find_vaccine(vaccine_type)
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 88, in find_vaccine
self.find_vaccine(vaccine_type)
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 88, in find_vaccine
self.find_vaccine(vaccine_type)
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 88, in find_vaccine
self.find_vaccine(vaccine_type)
[Previous line repeated 990 more times]
File "C:\Users\kimch\Documents\code\selenium-kakao-vaccine-reservation\service\reservation.py", line 37, in find_vaccine
left_by_coords_url = constant.url.get('kakao').get('left_by_coords')
RecursionError: maximum recursion depth exceeded while calling a Python object

@cha2hyun cha2hyun added the bug Something isn't working label Aug 5, 2021
@binchoo binchoo added the 진행중 이슈를 인지하여 코드 개선중 label Aug 5, 2021
@binchoo
Copy link
Owner

binchoo commented Aug 5, 2021

기존 LegacyVaccineReservation 에서 무한 루프로 요청 보내는 작업을 감싸고 있는데요.
여기에 find_vaccine을 재귀호출 하는 코드가 두 곳이 존재합니다.
이 라인들은 백신 여분이 없거나, 백신 예약에 실패했을 때 진입합니다.

if found is None:
self.find_vaccine(vaccine_type)
print(f"주소는 : {found.get('address')} 입니다.")
organization_code = found.get('orgCode')
if vaccine_type == "ANY":
try_vaccine_types = ['VEN00013', 'VEN00014', 'VEN00015', 'VEN00016']
else:
try_vaccine_types = [vaccine_type]
for vaccine_type in try_vaccine_types:
print(f"{vaccine_type} 으로 예약을 시도합니다.")
if self.try_reservation(organization_code, vaccine_type) is not None:
return None
self.find_vaccine(vaccine_type)

그러나 재귀 호출 없이 무한 루프만으로 매크로 요청을 지속할 수 있으므로, 해당 코드들을 제거하는 방향으로 개선해 보겠습니다.
이슈 등록 감사합니다 (_ _)

RegionCapture나 Reservation 서비스들은 Thread로 실행할 수 있도록 프록시를 작성해 볼 예정입니다!

@cha2hyun
Copy link
Author

cha2hyun commented Aug 5, 2021

멋지십니다 👍

binchoo added a commit that referenced this issue Aug 5, 2021
@binchoo binchoo added 해결: 수정 이슈를 인지하여 코드를 수정하였다 and removed 진행중 이슈를 인지하여 코드 개선중 labels Aug 5, 2021
@binchoo
Copy link
Owner

binchoo commented Aug 5, 2021

작업 완료하였습니다. master로 머지합니다.
오늘 올려주신 이슈들은 QA 1.09 릴리스로 재발행합니다. 기여 정말 감사합니다.

@binchoo binchoo mentioned this issue Aug 5, 2021
@binchoo binchoo closed this as completed Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working 해결: 수정 이슈를 인지하여 코드를 수정하였다
Projects
None yet
Development

No branches or pull requests

2 participants