Skip to content

Commit

Permalink
fix issue with uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
matfish3 committed Jun 22, 2022
1 parent a893c92 commit e3b429a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/RecordRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ public function record(): void
$start = microtime(true);

Event::on(Response::class, Response::EVENT_AFTER_SEND, function ($event) use ($record, $start) {
$record->execTime = round(microtime(true) - $start, 2);
$record->responseCode = $event->sender->getStatusCode();
$record->save();
try {
$record->execTime = round(microtime(true) - $start, 2);
$record->responseCode = $event->sender->getStatusCode();
$record->save();
} catch (\Exception $e) {
// handle issue this event is called when uninstalling the plugin
return;
}

});
}

Expand Down

0 comments on commit e3b429a

Please sign in to comment.