zulip/zerver
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
..
fixtures Fix assignee in JIRA created message 2013-09-06 11:24:03 -04:00
lib Optimize user presence/activity query. 2013-09-16 11:29:10 -04:00
management Add documentation and a duration argument to analyze_user_activity.py 2013-09-10 13:25:59 -04:00
migrations [schema] Add muted_topics to UserProfile 2013-09-11 16:47:37 -04:00
templatetags [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
tests/frontend Get stream_data.js back to 100% coverage 2013-09-12 17:23:52 -04:00
views Added /json/set_muted_topics 2013-09-11 16:47:37 -04:00
__init__.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
context_processors.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
decorator.py Comment that authenticated_rest_api_view does Basic auth 2013-09-04 13:19:22 -04:00
exceptions.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
filters.py Change Humbug => Zulip in name of exception filter module. 2013-08-07 10:00:07 -04:00
finders.py Change Humbug => Zulip in name of finder module. 2013-08-07 10:00:07 -04:00
forms.py Removed confusing ALLOW_REGISTER setting. 2013-08-12 16:16:26 -04:00
handlers.py Change Humbug => Zulip in names of error reporting handlers. 2013-08-07 10:00:07 -04:00
middleware.py Give recipient_cache and associated functions a clearer name. 2013-08-28 10:23:40 -04:00
models.py Optimize user presence/activity query. 2013-09-16 11:29:10 -04:00
openid.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
retention_policy.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
static_header.txt Change Humbug => Zulip in text/comments. 2013-08-07 10:00:07 -04:00
storage.py Change Humbug => Zulip in name of storage module. 2013-08-07 10:00:07 -04:00
tests.py Added /json/set_muted_topics 2013-09-11 16:47:37 -04:00
tornado_callbacks.py Add presences info to the event data for process_new_message(). 2013-09-16 11:24:12 -04:00
tornadoviews.py Let clients specify how long queues shall live, within limits 2013-08-20 16:19:07 -04:00