Go to file
Steve Howell 85f9b6695f Optimize user presence/activity query.
The get_status_dict_by_realm helper gets called whenever our
 realm user_presences cache expires, and it used to query these fields:

    "zerver_userpresence"."id", "zerver_userpresence"."user_profile_id", "zerver_userpresence"."client_id", "zerver_userpresence"."timestamp", "zerver_userpresence"."status", "zerver_userprofile"."id", "zerver_userprofile"."password", "zerver_userprofile"."last_login", "zerver_userprofile"."is_superuser", "zerver_userprofile"."email", "zerver_userprofile"."is_staff", "zerver_userprofile"."is_active", "zerver_userprofile"."is_bot", "zerver_userprofile"."date_joined", "zerver_userprofile"."bot_owner_id", "zerver_userprofile"."full_name", "zerver_userprofile"."short_name", "zerver_userprofile"."pointer", "zerver_userprofile"."last_pointer_updater", "zerver_userprofile"."realm_id", "zerver_userprofile"."api_key", "zerver_userprofile"."enable_desktop_notifications", "zerver_userprofile"."enable_sounds", "zerver_userprofile"."enter_sends", "zerver_userprofile"."enable_offline_email_notifications", "zerver_userprofile"."last_reminder", "zerver_userprofile"."rate_limits", "zerver_userprofile"."avatar_source", "zerver_userprofile"."tutorial_status", "zerver_userprofile"."onboarding_steps", "zerver_userprofile"."invites_granted", "zerver_userprofile"."invites_used", "zerver_userprofile"."alert_words", "zerver_userprofile"."muted_topics", "zerver_client"."id", "zerver_client"."name"

Now it queries just the fields it needs:

  "zerver_client"."name", "zerver_userpresence"."status", "zerver_userpresence"."timestamp", "zerver_userprofile"."email" FROM "zerver_userpresence"

Also, get_status_dict_by_realm is now namespaced under UserPresence as a static method.

(imported from commit be1266844b6bd28b6c615594796713c026a850a1)
2013-09-16 11:29:10 -04:00
api Basecamp mirroring script 2013-08-30 20:00:07 +00:00
assets Change Humbug => Zulip in text/comments. 2013-08-07 10:00:07 -04:00
bots Replace configuration references to trac.humbughq.com with trac.zulip.net 2013-09-05 15:43:08 -04:00
certs Switch nagios to .zulip.net and add cert 2013-09-05 15:43:07 -04:00
confirmation Move to a common random token generation function instead of several one-offs. 2013-08-09 14:59:26 -04:00
humbug Rename Django project to zproject. 2013-08-07 11:04:03 -04:00
node_modules Import Handlebars compiler and dependencies 2013-04-02 14:43:58 -04:00
servers Add aggregation for reading stats 2013-09-10 10:24:15 -04:00
static Open the composebox on sidebar subject selection. 2013-09-12 06:04:03 -04:00
templates Remove stale new-user and redirect to /hello 2013-09-11 18:10:17 -04:00
tools Persist muting preferences to the back end 2013-09-11 16:47:37 -04:00
zerver Optimize user presence/activity query. 2013-09-16 11:29:10 -04:00
zproject Remove stale new-user and redirect to /hello 2013-09-11 18:10:17 -04:00
.gitignore Add support for analyzing test coverage with Istanbul 2013-08-20 10:46:45 -04:00
manage.py Rename Django project to zproject. 2013-08-07 11:04:03 -04:00