Sync and release publishing resources; subclasses close storage. The base publishing properties are recreated lazily on next access. Resuming a subclass may require reopening storage or reacquiring locks.
(self)
| 476 | pass |
| 477 | |
| 478 | def close(self): |
| 479 | """Sync and release publishing resources; subclasses close storage. |
| 480 | |
| 481 | The base publishing properties are recreated lazily on next access. |
| 482 | Resuming a subclass may require reopening storage or reacquiring locks. |
| 483 | """ |
| 484 | sync_failed = True |
| 485 | try: |
| 486 | self.sync() |
| 487 | sync_failed = False |
| 488 | finally: |
| 489 | # Inspect the cache so closing an unused scheduler cannot open |
| 490 | # a broker connection. Releasing it also closes its channels. |
| 491 | self.__dict__.pop('producer', None) |
| 492 | connection = self.__dict__.pop('connection', None) |
| 493 | if connection is not None: |
| 494 | try: |
| 495 | ignore_errors(connection, connection.release) |
| 496 | except Exception: |
| 497 | if not sync_failed: |
| 498 | raise |
| 499 | error('beat: Connection cleanup failed after sync error', |
| 500 | exc_info=True) |
| 501 | |
| 502 | def add(self, **kwargs): |
| 503 | entry = self.Entry(app=self.app, **kwargs) |