failing-worker.php 298 B

123456789101112131415161718
  1. <?php
  2. $fail = random_int(1, 100) < 10;
  3. $wait = random_int(1000 * 100, 1000 * 500); // wait 100ms - 500ms
  4. usleep($wait);
  5. if ($fail) {
  6. exit(1);
  7. }
  8. while (frankenphp_handle_request(function () {
  9. echo "ok";
  10. })) {
  11. $fail = random_int(1, 100) < 10;
  12. if ($fail) {
  13. exit(1);
  14. }
  15. }