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

API Error during startup #6

Closed
fotoente opened this issue Jun 28, 2022 · 4 comments
Closed

API Error during startup #6

fotoente opened this issue Jun 28, 2022 · 4 comments
Assignees

Comments

@fotoente
Copy link

Sometimes, when a bot is started he throws an exception. Most of the time it works fine but sometimes it just fails...
Until now i couldn't make out a pattern...

Jun 28 21:37:11 Misskey-1 systemd[1]: Started Roboduck Bot.
Jun 28 21:37:12 Misskey-1 python3.10[881]: Traceback (most recent call last):
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/home/misskey/roboduck/rdbot.py", line 68, in <module>
Jun 28 21:37:12 Misskey-1 python3.10[881]:     asyncio.run(bot.start(url, token))
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
Jun 28 21:37:12 Misskey-1 python3.10[881]:     return loop.run_until_complete(main)
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
Jun 28 21:37:12 Misskey-1 python3.10[881]:     return future.result()
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/local/lib/python3.10/dist-packages/mipa/client.py", line 257, in start
Jun 28 21:37:12 Misskey-1 python3.10[881]:     await self.login(token, origin_url)
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/local/lib/python3.10/dist-packages/mipa/client.py", line 189, in login
Jun 28 21:37:12 Misskey-1 python3.10[881]:     await api.http.login()
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/local/lib/python3.10/dist-packages/mipac/http.py", line 100, in login
Jun 28 21:37:12 Misskey-1 python3.10[881]:     data = await self.request(Route('POST', '/api/i'), auth=True)
Jun 28 21:37:12 Misskey-1 python3.10[881]:   File "/usr/local/lib/python3.10/dist-packages/mipac/http.py", line 93, in request
Jun 28 21:37:12 Misskey-1 python3.10[881]:     raise APIError(data)
Jun 28 21:37:12 Misskey-1 python3.10[881]: mipac.exception.APIError: None
Jun 28 21:37:12 Misskey-1 python3.10[881]: Unclosed client session
Jun 28 21:37:12 Misskey-1 python3.10[881]: client_session: <aiohttp.client.ClientSession object at 0x7f9859105ae0>
Jun 28 21:37:12 Misskey-1 python3.10[881]: Unclosed connector
Jun 28 21:37:12 Misskey-1 python3.10[881]: connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f9858e76140>, 13.122160452)]']
Jun 28 21:37:12 Misskey-1 python3.10[881]: connector: <aiohttp.connector.TCPConnector object at 0x7f98591059f0>
@yupix
Copy link
Owner

yupix commented Jun 29, 2022

This may be a problem with the instance used by ente, as the API is not returning any data, so it may be a problem with the instance used by ente.

I'll look into it, but I don't think it's reproducible.

@yupix
Copy link
Owner

yupix commented Jun 29, 2022

Also, please be sure to provide an excerpt of the code where the problem occurred.
We have created a template for issues, so please follow it from now on.

@yupix
Copy link
Owner

yupix commented Jun 29, 2022

Perhaps the easiest solution is to change the code like this. We will include the HTTP CODE in errors related to the API in the next update. If you encounter this problem again after that, please reply here with the new error.

https://github.com/fotoente/MIsskey-ebooks-bot/blob/main/rdbot.py#L68

from mipac.exception import APIError

...

try
    asyncio.run(bot.start(url, token))
except APIError:
    # Place the process to run the bot again

@yupix
Copy link
Owner

yupix commented Jul 10, 2022

I don't know the status, so I will close it once. If the same problem occurs, please reopen

@yupix yupix closed this as completed Jul 10, 2022
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