ckcr4lyf / kiryuu

A highly performant HTTP bittorrent tracker (WIP)
Do What The F*ck You Want To Public License
13 stars 3 forks source link

Caching bug on long term seeders #34

Closed ckcr4lyf closed 1 year ago

ckcr4lyf commented 1 year ago

Currently, if an announce can be served from cache (no "change"), we do so.

In the case of long term seeders, there is no change to seed_count or leech_count , so we don't ZADD them to the seeders: https://github.com/ckcr4lyf/kiryuu/blob/92611e8069c7205958cc475d9cf4478409db4e27/src/main.rs#L106-L125

As a result, they get cleaned up by the cleanup job when it runs every 2 hours, since it thinks the peer is older than 31 minutes - Which it isn't - it's just that the recent announce didn't update in redis.

This is probably why the cache hits drop every 2 hours - since we delete peers who are active, and on a subsequent announce thinking we need to invalidate the cache for a "new seeder"

image

Fix: Even if there is no change to the cache, we need to call ZADD to update the seeder's timestamp.

ckcr4lyf commented 1 year ago

image

Fixed via #35