Out of memory error on OAuth2 client edition

on client that has a big number of voided accesstoken,
the edit client ui on web interface was erroring
due a out of memory exception for PHP process.

Change-Id: Iaf2f70b710571f8139bfdb9b42f4cfe4dd4bee80
This commit is contained in:
Sebastian Marcet 2016-09-22 13:41:47 -03:00
parent 6e7136da56
commit dc272d6ab0
1 changed files with 2 additions and 1 deletions

View File

@ -1352,7 +1352,8 @@ final class TokenService implements ITokenService
throw new AbsentClientException(sprintf("client id %d does not exists!", $client_id));
}
$res = array();
$access_tokens = $client->access_tokens()->get();
// not void condition
$access_tokens = $client->access_tokens()->whereRaw(" DATE_ADD(created_at, INTERVAL lifetime second) >= UTC_TIMESTAMP() ")->get();
foreach ($access_tokens as $access_token) {
if (!$access_token->isVoid()) {
array_push($res, $access_token);