Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner committed Oct 4, 2024
1 parent 713ab90 commit 4b58444
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Commands/SyncAttributeMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public function handle(MetadataService $service): void
$query->chunk(
config('enjin-platform.sync_metadata.data_chunk_size'),
function ($attributes) use ($progress, $service): void {
$attributes->each(fn (Attribute $attribute) => $service->fetchAndCache($attribute));
$progress->advance($attributes->count());
$attributes->each(function (Attribute $attribute) use ($progress, $service): void {
$service->fetchAndCache($attribute);
$progress->advance(1);
});

}
);
$progress->finish();
Expand Down
6 changes: 5 additions & 1 deletion src/Services/Database/MetadataService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ public function fetchAndCache(?Attribute $attribute): mixed
);
}

public function getCache(Attribute $attribute): mixed
public function getCache(?Attribute $attribute): mixed
{
if (!filter_var($attribute?->value, FILTER_VALIDATE_URL)) {
return null;
}

return Cache::get($this->cacheKey($attribute->value), $this->fetchAndCache($attribute));
}

Expand Down

0 comments on commit 4b58444

Please sign in to comment.