Skip to content
New issue

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

Retry connection to callink API after read timeout #231

Open
ethanhs opened this issue Sep 28, 2021 · 1 comment
Open

Retry connection to callink API after read timeout #231

ethanhs opened this issue Sep 28, 2021 · 1 comment

Comments

@ethanhs
Copy link
Member

ethanhs commented Sep 28, 2021

It seems that callink will (not infrequently, but rarely enough...) timeout on trying to connect to their API endpoint. We should retry the connection. The error looks something like:

.... more traceback above

Traceback (most recent call last):
  File "/opt/share/utils/sbin/signat", line 212, in <module>
    main()
  File "/opt/share/utils/sbin/signat", line 204, in main
    show_by_username(args.username)
  File "/opt/share/utils/sbin/signat", line 49, in show_by_username
    show_groups_by_student_signat(uid)
  File "/opt/share/utils/sbin/signat", line 97, in show_groups_by_student_signat
    groups = groups_by_student_signat(uid)
  File "/usr/lib/python3/dist-packages/ocflib/ucb/groups.py", line 135, in groups_by_student_signat
    return _get_osl({'UID': uid}, service, parser)
  File "/usr/lib/python3/dist-packages/ocflib/ucb/groups.py", line 150, in _get_osl
    r = requests.get(url, timeout=20)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='studentgroupservice.sait-west.berkeley.edu', port=443): Readtimed out. (read timeout=20)
@ben9583
Copy link
Member

ben9583 commented Oct 2, 2021

This also happens if you try to run signat oid [oid] where oid is greater than 2^31-1. Obviously, there are no organizations beyond here, but it may be good to just handle the timeout as opposed to throwing the python exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants