Skip to content

Commit

Permalink
Log when we cache an address as invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstauffer committed Dec 28, 2023
1 parent ea4af41 commit 2e0512c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/Services/Geocoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Casts\Coordinates;
use App\Exceptions\InvalidAddressGeocodingException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

class Geocoder
{
Expand All @@ -17,6 +18,7 @@ public function geocode(string $address): Coordinates
$response = $this->requestGeocoding($address);

if (! count($response['results'])) {
Log::debug('Caching address as invalid: [' . $address . ']');
cache()->set('invalid-address::' . md5($address), true);
throw new InvalidAddressGeocodingException();
}
Expand Down

0 comments on commit 2e0512c

Please sign in to comment.