| Age | Commit message (Collapse) | Author |
|
|
|
|
|
Now default values are stored in one place :3
|
|
- Now runner only gets petter as the arguemnt, not petter's arguemnts
- Petters has its own directory
|
|
Shards are way to fix the problem with 429
|
|
- Rename `Bot` from `petthecord.runner` to `PetTheCord`
- Add all classes to the __init__.py
|
|
When I was checking logs I've found that when ptc tries to update cache
because of new avatar the function raises an error about some
non-existent file:
Traceback (most recent call last):
File "/var/lib/ptc/venv/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
resp = await request_handler(request)
File "/var/lib/ptc/venv/lib/python3.10/site-packages/aiohttp/web_app.py", line 537, in _handle
resp = await handler(request)
File "/var/lib/ptc/venv/lib/python3.10/site-packages/petthecord/server.py", line 35, in petpet
return Response(body=await self._petter.petpet(uid), content_type="image/gif")
File "/var/lib/ptc/venv/lib/python3.10/site-packages/petthecord/cache.py", line 74, in petpet
remove(path)
FileNotFoundError: [Errno 2] No such file or directory: '/var/cache/petthecord/...gif'
Well, I think that it's OK to just suppress the error because GC still
will remove all unneeded files.
|
|
|
|
When I was checking log of this bot I've noticed that thing in gc loop
Traceback (most recent call last):
File "/var/lib/ptc/venv/lib/python3.10/site-packages/discord/client.py", line 449, in _run_event
await coro(*args, **kwargs)
File "/var/lib/ptc/venv/lib/python3.10/site-packages/petthecord/runner.py", line 57, in on_ready
await petter.gc_loop()
File "/var/lib/ptc/venv/lib/python3.10/site-packages/petthecord/cache.py", line 107, in gc_loop
del self._cache[filename.split('_')[0]]
KeyError: '...'
I don't really want to know why this error has occured, but IMO it's
something related to broken index.json. So to fix the bug I just wrapped
deleting action to try-except block which will ignore the KeyError
exception. TBH looks like a kludge, but as I said I don't want to get
into it :>
|
|
- Move caching to another file
- Rename some files
- Make loggers look ok
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Implement idea from
https://raw.githubusercontent.com/nakidai/cptc/d69da87a74ea1fc18b73ec7660dad7d590e28ddd/TODO
|
|
|
|
|
|
|
|
|