Skip to content

Commit 658645c

Browse files
authored
[Bref] Restart after uncaught exception (#82)
* [Bref] Restart after uncaught exception * csfix * Added changelog * Use exit code 0
1 parent 6217ef2 commit 658645c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CHANGELOG.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [NOT RELEASED]
44

5+
## 0.2.2
6+
7+
### Fixed
8+
9+
- Make sure to restart process if there is an uncaught exception
10+
511
## 0.2.1
612

713
### Added
@@ -12,12 +18,12 @@
1218

1319
### Added
1420

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

1824
### Fixed
1925

20-
- Session handling for Symfony 5.4 and up.
26+
- Session handling for Symfony 5.4 and up
2127
- Error handling on invalid `_HANDLER` string
2228

2329
## 0.1.1

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"ext-json": "*",
14-
"bref/bref": "^1.2",
14+
"bref/bref": "^1.3",
1515
"clue/arguments": "^2.1",
1616
"psr/http-server-handler": "^1.0",
1717
"riverline/multipart-parser": "^2.0",

src/BrefRunner.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ public function run(): int
3131
if (++$loops > $this->loopMax) {
3232
return 0;
3333
}
34-
$lambda->processNextEvent($this->handler);
34+
35+
/**
36+
* In case the execution failed, we force starting a new process regardless
37+
* of $this->loopMax. This is because an uncaught exception could have
38+
* left the application in a non-clean state.
39+
*/
40+
if (!$lambda->processNextEvent($this->handler)) {
41+
return 0;
42+
}
3543
}
3644
}
3745
}

0 commit comments

Comments
 (0)