Pass the session that updated the pointer from Django to Tornado

This allows us to check whether the session that updated the pointer
is the same as a session that is doing a long poll to avoid sending
new pointer information when that information is coming from the same
session.

We still return from the long poll early, though, which is sub-optimal.

(imported from commit 7d4be0956f112eacefb7d198ea929957cd2b05e3)
This commit is contained in:
Zev Benjamin
2012-10-22 17:06:22 -04:00
parent d17db6687c
commit f817bf6144
2 changed files with 10 additions and 6 deletions

View File

@@ -126,11 +126,12 @@ class UserProfile(models.Model):
callbacks_table.clear(self.user.id, Callbacks.TYPE_RECEIVE)
def update_pointer(self, new_pointer):
def update_pointer(self, new_pointer, updater_session):
global callbacks_table
for cb in callbacks_table.get(self.user.id, Callbacks.TYPE_POINTER_UPDATE):
cb(new_pointer=new_pointer)
cb(new_pointer=new_pointer, updater_session=updater_session,
user_profile=self)
callbacks_table.clear(self.user.id, Callbacks.TYPE_POINTER_UPDATE)