kotatsugame / atgolfer

https://twitter.com/atgolfer1
MIT License
2 stars 1 forks source link

atgolferが止まってるので再起動かなんかお願いします #13

Closed kmyk closed 5 years ago

kmyk commented 5 years ago

https://twitter.com/henkoudekimasu/status/1165281616081707008

kmyk commented 5 years ago

ログ見るとふたつの異なる理由で落ちてて不穏だ

Traceback (most recent call last):
  File "/home/ubuntu/atgolfer/main.py", line 290, in <module>
    main()
  File "/home/ubuntu/atgolfer/main.py", line 271, in main
    raise e
  File "/home/ubuntu/atgolfer/main.py", line 265, in main
    for data in gen:
  File "/home/ubuntu/atgolfer/main.py", line 217, in read_atcoder_problems
    merged_problems: List[Dict[str, Any]] = get_json('https://kenkoooo.com/atcoder/atcoder-api/info/merged-problems')
  File "/home/ubuntu/atgolfer/main.py", line 47, in get_json
    resp.raise_for_status()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://kenkoooo.com/atcoder/atcoder-api/info/merged-problems
Traceback (most recent call last):
  File "/home/ubuntu/atgolfer/main.py", line 290, in <module>
    main()
  File "/home/ubuntu/atgolfer/main.py", line 271, in main
    raise e
  File "/home/ubuntu/atgolfer/main.py", line 266, in main
    post_text(data['text'], in_reply_to_status_id=last_status_id.get(data['problem_id']))
  File "/home/ubuntu/atgolfer/main.py", line 253, in post_text
    status = api.PostUpdate(text, in_reply_to_status_id=in_reply_to_status_id)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 1176, in PostUpdate
    resp = self._RequestUrl(url, 'POST', data=parameters)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 4962, in _RequestUrl
    limit = self.CheckRateLimit(url)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 4809, in CheckRateLimit
    self.InitializeRateLimit()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 4792, in InitializeRateLimit
    data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 4908, in _ParseAndCheckTwitter
    self._CheckForTwitterError(data)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/twitter/api.py", line 4928, in _CheckForTwitterError
    raise TwitterError(data['errors'])
twitter.error.TwitterError: [{'code': 32, 'message': 'Could not authenticate you.'}]
kmyk commented 5 years ago

500 が再現したのでとりあえず kenkoooo さんに問い合わせしといた https://github.com/kenkoooo/AtCoderProblems/issues/241

kmyk commented 5 years ago

Problems の方は endpoint を更新したら回避できた。 でも twitter.error.TwitterError: [{'code': 32, 'message': 'Could not authenticate you.'}] は残っててきびしい。

kmyk commented 5 years ago

依存の python-twitter を更新 (3.5) したら例外が新しいのに変わった

Traceback (most recent call last):
  File "/home/ubuntu/atgolfer/main.py", line 290, in <module>
    main()
  File "/home/ubuntu/atgolfer/main.py", line 271, in main
    raise e
  File "/home/ubuntu/atgolfer/main.py", line 265, in main
    for data in gen:
  File "/home/ubuntu/atgolfer/main.py", line 211, in read_atcoder
    for data in crawl_contest(contest, shortest_codes=shortest_codes, latest_submission_ids=latest_submission_ids):
  File "/home/ubuntu/atgolfer/main.py", line 116, in crawl_contest
    old_size = shortest_codes[task_id]['size']
KeyError: 'size'
kmyk commented 5 years ago

twitter.error.TwitterError: [{'code': 32, 'message': 'Could not authenticate you.'}] で落ちると DB (shortest_codes.json) に不整合がおきるぽい。せめて SQLite を使うべきなんだよな

kmyk commented 5 years ago

App が SUSPENDED でした。再申請します https://twitter.com/a3VtYQo/status/1165302109434081280

kmyk commented 5 years ago

再申請しました。動きました。終了です