Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Get the global stats periodically #1626

Merged
merged 2 commits into from
Oct 25, 2013
Merged

Get the global stats periodically #1626

merged 2 commits into from
Oct 25, 2013

Conversation

bruceadams
Copy link
Contributor

Global stats, user count and weekly dollar exchange, were being gathered on every single request, even requests for static assets. This commit changes the action to only look in the database during homepage cache updates and carry the data in memory so it is available to the application.

Global stats, user count and weekly dollar exchange, were being gathered
on every single request, even requests for static assets. This commit
changes the action to only look in the database during homepage cache
updates and carry the data in memory so it is available to the
application.
request.context['gnactive'] = gnactive
request.context['gtransfer_volume'] = gtransfer_volume

website.hooks.inbound_early += [add_stuff]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we rename the add_stuff method to something like set_up_session_context?

@@ -340,6 +341,15 @@ def get_participant(request, restrict=True):
return participant


def update_global_stats(website):
stats = gittip.db.one( "SELECT nactive, transfer_volume FROM paydays "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, we may as well use website.db here instead of gittip.db. Eventually we want to root out the gittip.db global (#1528).

chadwhitacre added a commit that referenced this pull request Oct 25, 2013
Get the global stats periodically
@chadwhitacre chadwhitacre merged commit 99c0725 into master Oct 25, 2013
@chadwhitacre chadwhitacre deleted the cache-stats branch October 25, 2013 01:56
@chadwhitacre
Copy link
Contributor

!m @bruceadams

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants