Don't get new items for people buffers

This commit is contained in:
Manuel Cortez 2015-12-26 23:28:46 -06:00
parent 0afba81c71
commit 9d0c9cfdb5
3 changed files with 7 additions and 8 deletions

View File

@ -868,10 +868,10 @@ class peopleBufferController(baseBufferController):
pub.sendMessage("execute-action", action="user_details")
class searchBufferController(baseBufferController):
def start_stream(self):
def start_stream(self, mandatory=False):
# starts stream every 3 minutes.
current_time = time.time()
if self.execution_time == 0 or current_time-self.execution_time >= 180:
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
self.execution_time = current_time
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
@ -907,10 +907,10 @@ class searchPeopleBufferController(peopleBufferController):
self.kwargs = kwargs
self.function = function
def start_stream(self):
def start_stream(self, mandatory=False):
# starts stream every 3 minutes.
current_time = time.time()
if self.execution_time == 0 or current_time-self.execution_time >= 180:
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
self.execution_time = current_time
log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))

View File

@ -436,7 +436,7 @@ class Controller(object):
return
elif dlg.get("users") == True:
search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term)
search.start_stream()
search.start_stream(mandatory=True)
pos=self.view.search("searches", buffer.session.db["user_name"])
self.insert_buffer(search, pos)
self.view.insert_buffer(search.buffer, name=_(u"Search for {}").format(term), pos=pos)

View File

@ -279,8 +279,7 @@ class Session(object):
tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
self.order_buffer(name, tl)
# @_require_login
def get_cursored_stream(self, name, function, items="users", *args, **kwargs):
def get_cursored_stream(self, name, function, items="users", get_previous=False, *args, **kwargs):
""" Gets items for API calls that require using cursors to paginate the results.
name str: Name to save it in the database.
@ -290,7 +289,7 @@ class Session(object):
items_ = []
try:
if self.db[name].has_key("cursor"):
if self.db[name].has_key("cursor") and get_previous:
cursor = self.db[name]["cursor"]
else:
cursor = -1