| 60 | self._stack = None |
| 61 | |
| 62 | def enable(self): |
| 63 | self.old_heartbeat_frequency = common.HEARTBEAT_FREQUENCY |
| 64 | self.old_min_heartbeat_interval = common.MIN_HEARTBEAT_INTERVAL |
| 65 | self.old_kill_cursor_frequency = common.KILL_CURSOR_FREQUENCY |
| 66 | self.old_events_queue_frequency = common.EVENTS_QUEUE_FREQUENCY |
| 67 | |
| 68 | if self.heartbeat_frequency is not None: |
| 69 | common.HEARTBEAT_FREQUENCY = self.heartbeat_frequency |
| 70 | |
| 71 | if self.min_heartbeat_interval is not None: |
| 72 | common.MIN_HEARTBEAT_INTERVAL = self.min_heartbeat_interval |
| 73 | |
| 74 | if self.kill_cursor_frequency is not None: |
| 75 | common.KILL_CURSOR_FREQUENCY = self.kill_cursor_frequency |
| 76 | |
| 77 | if self.events_queue_frequency is not None: |
| 78 | common.EVENTS_QUEUE_FREQUENCY = self.events_queue_frequency |
| 79 | self._enabled = True |
| 80 | # Store the allocation traceback to catch non-disabled client_knobs. |
| 81 | self._stack = "".join(traceback.format_stack()) |
| 82 | |
| 83 | def __enter__(self): |
| 84 | self.enable() |