Skip to content

Commit 88b64c4

Browse files
committed
Fuzzer improvements
1 parent 09850be commit 88b64c4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tools/fuzzer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,12 @@ function call(API $API, string $method, array $args = []): void
173173

174174
$methods = [];
175175

176-
$wait = static function () use (&$methods): void {
177-
if (count($methods) >= 10) {
176+
$wait = static function (bool $force = false) use (&$methods): void {
177+
if (count($methods) >= 10 || $force) {
178178
Logger::log("Processing ".implode(", ", array_keys($methods)));
179179
await($methods);
180180
Logger::log("Done!");
181+
Assert::isEmpty($methods, "Some methods were not processed!");
181182
}
182183
};
183184

@@ -262,6 +263,8 @@ function call(API $API, string $method, array $args = []): void
262263
$wait();
263264
}
264265

266+
$wait(true);
267+
265268
$toggleBusiness(false);
266269

267270
foreach ($names as $name) {
@@ -270,16 +273,13 @@ function call(API $API, string $method, array $args = []): void
270273
call($bot, $name);
271274
} catch (RPCErrorException|PTSException) {
272275
}
273-
unset($methods["bot $name"]);
276+
unset($methods["bot disconnected $name"]);
274277
});
275278

276279
$wait();
277280
}
278281

279-
Logger::log("Processing ".implode(", ", array_keys($methods)));
280-
await($methods);
281-
Logger::log("Done!");
282-
Assert::isEmpty($methods, "Some methods were not processed!");
282+
$wait(true);
283283

284284
unset($bot, $user, $unauthed);
285285

0 commit comments

Comments
 (0)