Waits the time previously set
(self, seconds=None, reconnect=None)
| 328 | return True |
| 329 | |
| 330 | def wait(self, seconds=None, reconnect=None): |
| 331 | """ |
| 332 | Waits the time previously set |
| 333 | """ |
| 334 | if seconds is not None: |
| 335 | self.set_wait(seconds) |
| 336 | |
| 337 | if reconnect is None: |
| 338 | reconnect = (seconds > self.config.get('max_wait', 10) * 60) |
| 339 | |
| 340 | self.set_reconnect(reconnect) |
| 341 | |
| 342 | wait_time = self.pyfile.waitUntil - time.time() |
| 343 | |
| 344 | if wait_time < 1: |
| 345 | self.log_warning(_("Invalid wait time interval")) |
| 346 | return |
| 347 | |
| 348 | self.waiting = True |
| 349 | |
| 350 | status = self.pyfile.status # @NOTE: Recheck in 0.4.10 |
| 351 | self.pyfile.setStatus("waiting") |
| 352 | |
| 353 | self.log_info(_("Waiting %s...") % format_time(wait_time)) |
| 354 | |
| 355 | if self.wantReconnect: |
| 356 | self.log_info(_("Requiring reconnection...")) |
| 357 | if self.account: |
| 358 | self.log_warning(_("Reconnection ignored due logged account")) |
| 359 | |
| 360 | if not self.wantReconnect or self.account: |
| 361 | while self.pyfile.waitUntil > time.time(): |
| 362 | self.check_status() |
| 363 | time.sleep(2) |
| 364 | |
| 365 | else: |
| 366 | while self.pyfile.waitUntil > time.time(): |
| 367 | self.check_status() |
| 368 | self.thread.m.reconnecting.wait(1) |
| 369 | |
| 370 | if self.thread.m.reconnecting.isSet(): |
| 371 | self.waiting = False |
| 372 | self.wantReconnect = False |
| 373 | |
| 374 | self.req.clearCookies() |
| 375 | raise Reconnect |
| 376 | |
| 377 | time.sleep(2) |
| 378 | |
| 379 | self.waiting = False |
| 380 | self.pyfile.status = status # @NOTE: Recheck in 0.4.10 |
| 381 | |
| 382 | def skip(self, msg=""): |
| 383 | """ |
no test coverage detected