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)