Increase worker count. Args: count: Number of workers to add (default 1) Returns: Dictionary with added count and new total
(self, count: int = 1)
| 225 | return {"listeners": listeners, "count": len(listeners)} |
| 226 | |
| 227 | def worker_add(self, count: int = 1) -> dict: |
| 228 | """ |
| 229 | Increase worker count. |
| 230 | |
| 231 | Args: |
| 232 | count: Number of workers to add (default 1) |
| 233 | |
| 234 | Returns: |
| 235 | Dictionary with added count and new total |
| 236 | """ |
| 237 | count = max(1, int(count)) |
| 238 | old_count = self.arbiter.num_workers |
| 239 | self.arbiter.num_workers += count |
| 240 | |
| 241 | # Wake up the arbiter to spawn workers |
| 242 | self.arbiter.wakeup() |
| 243 | |
| 244 | return { |
| 245 | "added": count, |
| 246 | "previous": old_count, |
| 247 | "total": self.arbiter.num_workers, |
| 248 | } |
| 249 | |
| 250 | def worker_remove(self, count: int = 1) -> dict: |
| 251 | """ |