Skip to content

Commit

Permalink
PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner committed Oct 10, 2024
1 parent f1f4bdb commit c05c2ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Enums/Global/PlatformCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ enum PlatformCache: string implements PlatformCacheable
case FEE = 'fee';
case DEPOSIT = 'deposit';
case RELEASE_DIFF = 'releaseDiff';

case BLOCK_EVENT_COUNT = 'blockEventCount';

case BLOCK_TRANSACTION = 'blockTransaction';
case REFRESH_METADATA = 'refreshMetadata';

public function key(?string $suffix = null, ?string $network = null): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Enjin\Platform\GraphQL\Schemas\Primary\Substrate\Mutations;

use Closure;
use Enjin\Platform\Enums\Global\PlatformCache;
use Enjin\Platform\Exceptions\PlatformException;
use Enjin\Platform\GraphQL\Base\Mutation;
use Enjin\Platform\GraphQL\Schemas\Primary\Substrate\Traits\HasEncodableTokenId;
Expand Down Expand Up @@ -76,9 +77,9 @@ public function resolve(
SerializationServiceInterface $serializationService,
MetadataService $metadataService,
): mixed {
$key = 'RefreshMetadataMutation'
. ':' . ($collectionId = Arr::get($args, 'collectionId'))
. ':' . ($tokenId = $this->encodeTokenId($args));
$key = PlatformCache::REFRESH_METADATA->key(
($collectionId = Arr::get($args, 'collectionId')) . ':' . ($tokenId = $this->encodeTokenId($args))
);
if (RateLimiter::tooManyAttempts($key, config('enjin-platform.sync_metadata.refresh_max_attempts'))) {
throw new PlatformException(
__('enjin-platform::error.too_many_requests', ['num' => RateLimiter::availableIn($key)])
Expand Down

0 comments on commit c05c2ca

Please sign in to comment.