Skip to content

Commit

Permalink
fix: less cache
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Feb 22, 2024
1 parent e13ab45 commit ceefd20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Client implements HttpClientInterface, HasSourceModelInterface

private ConfigInterface $config;
private CacheInterface $cache;
private int $ttlMarginInSeconds = 60;

public function __construct(ConfigInterface $config, ClientInterface $httpClient, CacheInterface $cache)
{
Expand Down Expand Up @@ -82,7 +81,7 @@ public function getAuthToken(): string
$this->cache->set(
$this->authTokenCacheKey(),
$response->token,
$expiresAt->subSeconds($this->ttlMarginInSeconds)->diffInSeconds(Carbon::now())
$expiresAt->diffInSeconds(Carbon::now()) / 2
);

return $response->token;
Expand Down
2 changes: 1 addition & 1 deletion tests/GetAuthTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function it_can_cache_and_return_auth_token()
->with(
$api->authTokenCacheKey(),
$this->tokenValue,
3600 - 60
1800
);
}

Expand Down

0 comments on commit ceefd20

Please sign in to comment.