mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
The cross-realm bots rarely change, and there are only a few of them, so we just query them all at once and put them in the cache. Also, we put the dictionaries in the cache, instead of the user objects, since there is nothing time-sensitive about the dictionaries, and they are small. This saves us a little time computing the avatar url and things like that, not to mention marshalling costs. This commit also fixes a theoretical bug where we would have stale cache entries if somebody somehow modified the cross-realm bots without bumping KEY_PREFIX. Internally we no longer pre-fetch the realm objects for the bots, but we don't get overly precise about picking individual fields from UserProfile, since we rarely hit the database and since we don't store raw ORM objects in the cache. The test diffs make it look like we are hitting the cache an extra time, but the tests weren't counting bulk fetches. Now we only use a single key for all bots rather a key per bot.
26 KiB
26 KiB