Signal request thread to close as soon as it can.
(self)
| 167 | self.exception_queue.put(ex) |
| 168 | |
| 169 | def shutdown(self): |
| 170 | """ |
| 171 | Signal request thread to close as soon as it can. |
| 172 | """ |
| 173 | self.cancel = True |
| 174 | # Enqueue None to optimistically unblock background threads so |
| 175 | # they can check for the cancellation flag. |
| 176 | self.request_queue.put(None) |
| 177 | |
| 178 | # Wait for request thread to finish with a timeout in seconds. |
| 179 | self.request_thread.join(1) |
| 180 | |
| 181 | # close the underlying writer. |
| 182 | self.writer.close() |
| 183 | logger.info('Shutting down Json rpc client.') |
| 184 | |
| 185 | |
| 186 | class ReadState(enum.Enum): |