about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)Author
2024-11-07Edit origin argument's metavarNakidai
2024-11-07Move --no-cache argumentNakidai
2024-11-07Add defaultsNakidai
Now default values are stored in one place :3
2024-11-07Refactor cacheNakidai
- Now runner only gets petter as the arguemnt, not petter's arguemnts - Petters has its own directory
2024-11-05Add shard support, fix #2Nakidai
Shards are way to fix the problem with 429
2024-11-05Edit code's interfaceNakidai
- Rename `Bot` from `petthecord.runner` to `PetTheCord` - Add all classes to the __init__.py
2024-11-01Suppress error on removeNakidai
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.
2024-10-31Add warning on exceptNakidai
2024-10-29Possibly fix bug in GCNakidai
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 :>
2024-10-28RefactorNakidai
- Move caching to another file - Rename some files - Make loggers look ok
2024-10-27Do gc in a loopNakidai
2024-10-27Probably fix #1Nakidai
2024-10-27Add loggingNakidai
2024-10-27Add origin parameterNakidai
2024-10-27Remove debug printNakidai
2024-10-27Fix typo v1.3.0Nakidai
2024-10-27Add cachingNakidai
Implement idea from https://raw.githubusercontent.com/nakidai/cptc/d69da87a74ea1fc18b73ec7660dad7d590e28ddd/TODO
2024-09-14Add discord command v1.2.0Nakidai
2024-09-08Add redirect on rootNakidai
2024-09-04Fix runNakidai
2024-09-04Initial commitNakidai