Add data to push queue.
(self, scan_type: str, payload: dict, interface: str = None)
| 255 | self.stop_event = threading.Event() |
| 256 | |
| 257 | def enqueue(self, scan_type: str, payload: dict, interface: str = None): |
| 258 | """Add data to push queue.""" |
| 259 | if not self.cfg.push_enabled or not self.cfg.controller_url: |
| 260 | return |
| 261 | |
| 262 | item = { |
| 263 | 'agent_name': self.cfg.name, |
| 264 | 'scan_type': scan_type, |
| 265 | 'interface': interface, |
| 266 | 'payload': payload, |
| 267 | 'received_at': datetime.now(timezone.utc).isoformat(), |
| 268 | 'attempts': 0, |
| 269 | } |
| 270 | |
| 271 | try: |
| 272 | self.queue.put_nowait(item) |
| 273 | except queue.Full: |
| 274 | logger.warning("Push queue full, dropping payload") |
| 275 | |
| 276 | def run(self): |
| 277 | """Main push loop.""" |