Skip to content

Commit

Permalink
[Bref] Restart after uncaught exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Sep 20, 2021
1 parent 63c41a7 commit 34f06fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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
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
7 changes: 6 additions & 1 deletion src/bref/src/BrefRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ 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 BREF_LOOP_MAX
// Why: an exception could have left the application in a non-clean state, this is preventive
if (! $lambda->processNextEvent($this->handler)) {
return 1;
}
}
}
}

0 comments on commit 34f06fa

Please sign in to comment.