<feed xmlns='http://www.w3.org/2005/Atom'>
<title>petthecord/src, branch v1.4.3</title>
<subtitle>pet discord users
</subtitle>
<id>http://git.nakidai.ru/petthecord/atom?h=v1.4.3</id>
<link rel='self' href='http://git.nakidai.ru/petthecord/atom?h=v1.4.3'/>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/'/>
<updated>2024-10-31T23:47:03+00:00</updated>
<entry>
<title>Suppress error on remove</title>
<updated>2024-10-31T23:47:03+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-31T23:47:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=5a0faa2bccf9cdec1bb57f0c11f632679538ebc3'/>
<id>urn:sha1:5a0faa2bccf9cdec1bb57f0c11f632679538ebc3</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Add warning on except</title>
<updated>2024-10-31T20:54:35+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-31T20:54:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=815382fe0c48a2fc2af1c256b3e52a9f3433e20a'/>
<id>urn:sha1:815382fe0c48a2fc2af1c256b3e52a9f3433e20a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Possibly fix bug in GC</title>
<updated>2024-10-29T20:40:19+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-29T20:40:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=55ef8e5f692a1f7188263e861bc21cda2e8631e1'/>
<id>urn:sha1:55ef8e5f692a1f7188263e861bc21cda2e8631e1</id>
<content type='text'>
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 :&gt;
</content>
</entry>
<entry>
<title>Refactor</title>
<updated>2024-10-28T12:55:04+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-28T12:55:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=baaf3995646630de931113d4c554fd4867977b5c'/>
<id>urn:sha1:baaf3995646630de931113d4c554fd4867977b5c</id>
<content type='text'>
- Move caching to another file
- Rename some files
- Make loggers look ok
</content>
</entry>
<entry>
<title>Do gc in a loop</title>
<updated>2024-10-27T19:58:48+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T19:58:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=4b2ddc03f1e35cb0dea51dc96a00fb0a0ca49031'/>
<id>urn:sha1:4b2ddc03f1e35cb0dea51dc96a00fb0a0ca49031</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Probably fix #1</title>
<updated>2024-10-27T19:58:23+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T19:58:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=6c0d85a696f5622a5959a49b6be4bb4c0a67393e'/>
<id>urn:sha1:6c0d85a696f5622a5959a49b6be4bb4c0a67393e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add logging</title>
<updated>2024-10-27T19:42:04+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T19:42:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=a42d6702222c344d1f68cfd5aafc1dfb0e0fc2a5'/>
<id>urn:sha1:a42d6702222c344d1f68cfd5aafc1dfb0e0fc2a5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add origin parameter</title>
<updated>2024-10-27T18:33:15+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T18:33:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=38acd533869bdaac60af9636d087a2f9f9d59e0f'/>
<id>urn:sha1:38acd533869bdaac60af9636d087a2f9f9d59e0f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove debug print</title>
<updated>2024-10-27T17:35:54+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T17:35:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=bb42cbadc78c81a185a6ebfbc32e5e34cb87f646'/>
<id>urn:sha1:bb42cbadc78c81a185a6ebfbc32e5e34cb87f646</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix typo</title>
<updated>2024-10-27T08:47:01+00:00</updated>
<author>
<name>Nakidai</name>
<email>nakidai@disroot.org</email>
</author>
<published>2024-10-27T08:47:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.nakidai.ru/petthecord/commit/?id=054e08a906c5f361f712a96c541a0530f79e3a40'/>
<id>urn:sha1:054e08a906c5f361f712a96c541a0530f79e3a40</id>
<content type='text'>
</content>
</entry>
</feed>
