Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bref] Restart after uncaught exception #82

Merged
merged 4 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"bref/bref": "^1.2",
"bref/bref": "^1.3",
"clue/arguments": "^2.1",
"guzzlehttp/psr7": "^1.8 || ^2.0",
"illuminate/contracts": "^8.33",
Expand Down
10 changes: 8 additions & 2 deletions src/bref/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [NOT RELEASED]

## 0.2.2

### Fixed

- Make sure to restart process if there is an uncaught exception

## 0.2.1

### Added
Expand All @@ -12,12 +18,12 @@

### Added

- `vendor/bin/bref-local-handler.php` to invoke PSR-11 handlers locally.
- `vendor/bin/bref-local-handler.php` to invoke PSR-11 handlers locally
- Invocation and request context to the Request ServerBag

### Fixed

- Session handling for Symfony 5.4 and up.
- Session handling for Symfony 5.4 and up
- Error handling on invalid `_HANDLER` string

## 0.1.1
Expand Down
2 changes: 1 addition & 1 deletion src/bref/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"ext-json": "*",
"bref/bref": "^1.2",
"bref/bref": "^1.3",
"clue/arguments": "^2.1",
"psr/http-server-handler": "^1.0",
"riverline/multipart-parser": "^2.0",
Expand Down
10 changes: 9 additions & 1 deletion src/bref/src/BrefRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ public function run(): int
if (++$loops > $this->loopMax) {
return 0;
}
$lambda->processNextEvent($this->handler);

/**
* In case the execution failed, we force starting a new process regardless
* of $this->loopMax. This is because an uncaught exception could have
* left the application in a non-clean state.
*/
if (!$lambda->processNextEvent($this->handler)) {
return 0;
}
}
}
}