Close current session :param bool nonblock: Don't block thread. Used in closing from backend.
(self, nonblock=False)
| 107 | raise NotImplementedError |
| 108 | |
| 109 | def close(self, nonblock=False): |
| 110 | """Close current session |
| 111 | |
| 112 | :param bool nonblock: Don't block thread. Used in closing from backend. |
| 113 | """ |
| 114 | if self._closed: |
| 115 | return |
| 116 | self._closed = True |
| 117 | |
| 118 | self.deferred_functions.reverse() |
| 119 | while self.deferred_functions: |
| 120 | func = self.deferred_functions.pop() |
| 121 | try: |
| 122 | func() |
| 123 | except Exception as e: |
| 124 | msg = "Error occurred when running deferred function %s" % func |
| 125 | if isinstance(e, SessionException): |
| 126 | msg = "PyWebIO interactive functions cannot be called inside the deferred functions." |
| 127 | logger.exception(msg) |
| 128 | |
| 129 | def closed(self) -> bool: |
| 130 | return self._closed |
no outgoing calls
no test coverage detected