Today Sangmin Learned
article thumbnail
728x90

뭔.. 아무것도 안만졌는데 오류가 종종 생긴다 ;;

며칠 잘 나오다가 또

HTTPSConnectionPool(host='slack.com', port=443): Read timed out. (read timeout=10)

라는 오류가 같이 출력이 됐다. 그 이유를 찾아봐도 뚜렷하게 나오지가 않았는데, Slacker의 문제라기보단 AWS EC2 서버의 문제라고 생각했다. 그래서 구글링을 좀 해본 결과 

github.com/os/slacker/issues/132 에 누군가 나와 똑같은 오류에 대해 GitHub Issue를 직접 올린 것을 확인할 수 있었다.

 

exceptions.ReadTimeout gets raised even though the message goes through · Issue #132 · os/slacker

As described here in much detail, Slacker has recently started throwing lots of exceptions.ReadTimeout errors even when the message goes through just fine: File "/root/.homeassistant/deps/lib/...

github.com

결과적으론,

from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
...
retries = Retry(connect=5, read=3, redirect=3)
http_session = requests.Session()
http_session.mount('https://<yourdomain>.slack.com', HTTPAdapter(max_retries=retries))
...
<make your slack requests>
...

이런식으로 import 해오고 http_session에 대한 명령을 줌으로써 해결했다는 것이었다. 이를 AWS EC2 내에 slackbot.py 코드에 수정해줬다. 걍 명 수만 띄우는건데 무슨 문제가 이렇게 계속 생기는지 모르겠다 ㅋㅋ 

profile

Today Sangmin Learned

@steadily-worked

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!