Commit Graph

27 Commits

Author SHA1 Message Date
Tim Abbott c38092424e Clean up fetch_table_messages code a bit.
Fixes #792.  I'm really curious what (if anything) this change does to
our Tornado load numbers.

(imported from commit daf81d2dea81f36ec4a3eb19993169b58681e717)
2013-02-12 16:25:45 -05:00
Jessica McKellar f53e31e118 If a web client is requesting message that are too old, force a reload.
If get_updates requests a message ID that is too old, Tornado will
return a 400, and currently the only way to start caring about newer
message IDs is to reload.

(imported from commit 1638d71868475ffd793162afc7a2731cab14bd75)
2013-01-23 11:33:07 -05:00
Tim Abbott 13bbf20260 Restore original 25000 message cache size.
(imported from commit 5eb0da70a8514f75addcc042d1a3e3aa98711e25)
2013-01-17 16:20:18 -05:00
Tim Abbott 03ca42a988 tornado: On user_message/stream_message cache misses, query the database.
This should fix the issues we saw where users who hadn't received a
message in the cache would not be able to receive new messages.

(imported from commit 3834dd5bd5a10c7a603194b540d78afd8a966017)
2013-01-17 16:20:18 -05:00
Tim Abbott d4ad38882d Increase the usermessage cache to 50000 messages.
(imported from commit 3b937a45339c8ab68fe07901518df1b97885afd3)
2013-01-17 13:14:02 -05:00
Tim Abbott 0ab3b3947e Use a smaller cache for stream messages.
This is a hack to work around the fact that the query here takes far
longer than it should.

(imported from commit e6ee00c0636fe85cd946e4e3f2bbb2bda2da1f26)
2013-01-17 11:32:20 -05:00
Tim Abbott 9f93d9f46b tornado: Speed up Stream message cache initialization query.
The stream message cache query was grabbing an overly broad set of
columns and related models (e.g. the sender's user_profile), so that
Tornado would spend too long doing the query.

(imported from commit 6a692bc0e31957d4b9d9528d348c4b07a09eb15c)
2013-01-17 10:54:39 -05:00
Reid Barton ed29f22069 Implement single-stream get_old_messages/get_updates
(imported from commit 22a5c4985f36c38cf2490ecf26da294b502f8e46)
2013-01-16 14:19:05 -05:00
Reid Barton c9e2fed3f9 Preparatory changes to Tornado server for receiving a single stream's messages
Doesn't yet add the API for actually doing so.

(imported from commit a2062d71544441256a41f817388bb0c7ea6891ff)
2013-01-16 14:19:05 -05:00
Tim Abbott 47b2b1cb1c tornado: Fill the message memcached in a child process.
(imported from commit 3a7b4c0f4aad37319f4cfa7892709e99883f6a87)
2013-01-14 12:28:51 -05:00
Tim Abbott bea03548c2 tornado: Don't attempt to populate the memcached on restart.
Later, we can fork off a separate process to do that task, but for
now, we can just rely on the fact that unless the server was just
rebooted, the relevant messages will already be in that cache, and
even if it was, getting the needed messages once each is not a
particularly expensive query.

(imported from commit 6d08eba1b41237fd4e1204e181ce8f227573930d)
2013-01-14 12:28:48 -05:00
Tim Abbott 4df3c44a97 tornado: Fix order_by query during usermessage initialization.
(imported from commit e39556438ccb6487fe6be3e80d9c3b1e4cdf0cb7)
2013-01-11 16:19:31 -05:00
Tim Abbott 3636f22b2b tornado: Rename receive to receive_message.
(imported from commit 336273048c902941bb65755254bf253c0d130bd6)
2013-01-11 16:11:07 -05:00
Tim Abbott e36fd4b817 tornado: Send rendered messages to Tornado via memcached.
(imported from commit c1e8a017fa61b4e3f5c44ad4e5f59e4faf012ca3)
2013-01-11 16:11:07 -05:00
Tim Abbott a058471a56 tornado: Cache messages internally in tornado process.
This allows us to handle the return_messages_immediately part of
get_updates requests without having to talk to the database.

(imported from commit ed0b7742d359efb21a0a4960f4fc25f4337e9ad4)
2013-01-11 16:11:07 -05:00
Tim Abbott 053543e6eb tornado: Remove normal-runtime query in the user pointers code path.
We still need to do an initial query to get the pointers for all users.

(imported from commit 6ee991a648faf46539fd8676890dedb5f2003d05)
2013-01-11 16:11:07 -05:00
Tim Abbott f65ad3d59b Remove obsolete check for empty users string.
This code is from a previous protocol where the users array was posted
as a comma-separate list, rather than encoded via json.

(imported from commit 3a2edfcbf250a7eef305b2e98018c1361cc2fffe)
2013-01-10 16:59:36 -05:00
Tim Abbott 45b9de1e85 tornado: Remove UserProfile database queries from notify_new_message.
(imported from commit a23ce0cf7b8497e2ba7bc048d6fcf373f7ad913d)
2013-01-10 16:59:36 -05:00
Tim Abbott 8fe1edb6b0 tornado: Remove database queries from notify_pointer_update.
(imported from commit 218d5b804a4b4d9f7a1e9305165fd21820c26240)
2013-01-10 16:59:36 -05:00
Tim Abbott c3c59e938c Cache user pointers as they pass through Tornado.
(imported from commit 21a0dc0008ea5d3ac11388d3dd8d8cf8fa8a7e01)
2013-01-10 16:59:36 -05:00
Tim Abbott 62aed7c527 tornado: Move the add_*_callback functions a little earlier.
(imported from commit 2925e345fb9bd44c605350aac631c65a8f0601b6)
2013-01-10 16:59:36 -05:00
Tim Abbott 7274b24018 Callbacks: Reference users by user_profile_id, not user_id.
This is for consistency with the rest of our code dealing with message
delivery, which always uses the user_profile_id.

(imported from commit 5bf10bb9b994b0a98d3a22bd0bd86e542ab8a2ee)
2013-01-10 16:59:36 -05:00
Tim Abbott 21c2317bd2 Move callbacks library to tornadoviews.py.
(imported from commit a4e545d82133ae9dc34e283e3bf268225e35f400)
2013-01-10 16:59:36 -05:00
Tim Abbott b93db35e50 return_messages_immediately: Fix using last=None with dont_block.
Previously, if last was None, we wouldn't check dont_block,
server_generation, or any of the other reasons that get_updates might
return immediately, and just unconditionally entered longpolling mode.

In the process, this reorders return_messages_immediately to have
fewer cases and thus be easier to read.

(imported from commit 67803b8bfc7d9c9c1a4d6916eb2fb62664fb35a9)
2013-01-08 18:17:55 -05:00
Tim Abbott 40a3659844 return_messages_immediately: Remove check for clients with no messages.
This check was a workaround for the fact that the browser client
submitted a "last" value of -1.

(imported from commit a668f6a4e7a0c027f1214166a9bbf40d29b5daeb)
2013-01-08 18:17:55 -05:00
Tim Abbott 550bbe92ea get_updates: Move negative last checking to POST processing.
We shouldn't deploy this change until strictly after we deploy

"Fix website improperly submitting a last value of -1."

or we will break website clients.

(imported from commit 7f682ab0f7060b677f53f0a0073faef216f45d00)
2013-01-08 18:17:55 -05:00
Tim Abbott 83abc08315 Move tornado views to their own file.
(imported from commit e0d9182cbc89a16eedd2846fa17cfba482510565)
2013-01-08 16:53:53 -05:00