def _DEBUG_SIMULATION(self): yield 5.0 # user clicked the 'create new square' button #community = SquareCommunity.create_community(self._my_member, self._discovery) #yield 1.0 # user clicked the 'update my member info' button #community.set_my_member_info(u"SIM nickname", "") #yield 1.0 # user clicked the 'update square info' button #community.set_square_info(u"SIM title", u"SIM description", "", (0, 0), 0) #yield 1.0 #for index in xrange(5): # # user clicked the 'post message' button # community.post_text(u"SIM message %d" % index, "") # yield 1.0 def response_func(cache, event, request_timestamp): if cache: dprint(round(time.time() - request_timestamp, 2), "s ", event, "! received ", len(cache.suggestions), " suggestions; retrieved ", sum(1 if suggestion.hit else 0 for suggestion in cache.suggestions), " hits", force=1) yield 3.0 for index in xrange(999999): # user clicked the 'search' button dprint("NEW SEARCH", line=1, force=1) now = time.time() self._discovery.simple_member_search(u"member test %d" % index, response_func, (now,)) self._discovery.simple_square_search(u"square test %d" % index, response_func, (now,)) self._discovery.simple_text_search(u"text test %d" % index, response_func, (now,)) yield 30.0
def _DEBUG_QT_SIMULATION(self): yield 5.0 for index in xrange(999999): # user clicked the 'search' button dprint("NEW QT SEARCH", line=1, force=1) self.onSearchSquareClicked() yield 1 self._tgs.startNewSearch("member test $d" % index) #now = time.time() #self._discovery.simple_member_search(u"member test %d" % index, self._tgs.memberSearchUpdate.emit, (now,)) #self._discovery.simple_square_search(u"square test %d" % index, response_func, (now,)) #self._discovery.simple_text_search(u"text test %d" % index, response_func, (now,)) yield 30.0
def response_func(cache, event, request_timestamp): if cache: dprint(round(time.time() - request_timestamp, 2), "s ", event, "! received ", len(cache.suggestions), " suggestions; retrieved ", sum(1 if suggestion.hit else 0 for suggestion in cache.suggestions), " hits", force=1)