prettify

Wednesday, November 10, 2010

Rails RegExp Fragment Expiration

Challonge.com caches various bits of tournament data (including the brackets) as files. To avoid showing stale data, various events expire these fragments. In Rails, expiring fragments is done by either passing a unique identifier (for 1 fragment), or passing a regular expression (for multiple fragments).

Here's the catch with the regexps: ALL fragment paths pass through the regexp, even if the regexp specifies a directory path (e.g. /tournaments/592/.*). So, imagine a system with several thousands of fragments in roughly a thousand subdirectories. Now, expire fragments using a regexp every second or so. :-(

Needless to say, Challonge's server is much happier now with the regexp fragment expirations removed.

If you've managed a tournament with us before, you'll notice that adding/removing participants is now incredibly faster than before.

No comments:

Post a Comment