Why is my RPC growing completely?

I am trying to optimize my code and I have a problem that I do not quite understand. A list of notifications similar to the new Facebook ticker will appear on every page of my web application. Thus, for each request, I run this code at the beginning:

notification_query = db.Query(Ticker, keys_only=True)\
   .filter('friends =',self.current_user.key().name())
self._notifications_future = notification_query.run()

Then when I find a good place, I call the middle function, which:

notification_keys = [future.parent() for future in self._notifications_future]
self._notifications = db.get_async(notification_keys)

Finally, I pulled them all out at the end:

context.update({'notifications': self._notifications.get_result() })

Everything works fine except for this: if I call the middle function at the end of the query function, I get the following:

Dull spot

Dumb spot

And if I name it in what I think is an optimized place, I get the following:

Smart spot

Smart spot

As you can see, the use of the API doubles, making this "optimization". What's going on here?

2, . 12 - , 12 - - . , , .

pd: Google , ""?

UPDATE

, , dev_server, (smart version) appspot, :

appspot

appspot

, , , run() get_async(), . , dev_server. , localhost, .

+5
2

. , , , dev . dev , , . , , dev , . , , !

+1

, , Appstats , , , . , , .

+3

All Articles