(self, result)
| 304 | logger.debug("=== end scores ===") |
| 305 | |
| 306 | def shouldSend(self, result): |
| 307 | # Get max_results from handler, or use default |
| 308 | max_results = getattr(self.handler, 'max_results', self.NUM_RESULTS_TO_SEND) |
| 309 | |
| 310 | # Don't send if we've already reached the limit |
| 311 | if self.num_results_sent >= max_results: |
| 312 | return False |
| 313 | |
| 314 | should_send = False |
| 315 | # Allow sending if we're still well below the limit |
| 316 | if (self.num_results_sent < max_results - 3): |
| 317 | should_send = True |
| 318 | else: |
| 319 | # Near the limit - only send if this result is better than something we already sent |
| 320 | for r in self.rankedAnswers: |
| 321 | if r["sent"] and r["ranking"]["score"] < result["ranking"]["score"]: |
| 322 | should_send = True |
| 323 | break |
| 324 | |
| 325 | return should_send |
| 326 | |
| 327 | async def sendAnswers(self, answers, force=False): |
| 328 | if not self.handler.connection_alive_event.is_set(): |
no outgoing calls
no test coverage detected