[FIX] Seems like the sleep needed to be increased

Not 100% sure what happened, but images stopped being loaded into view with concurrent sessions.  Increased time to account for this
main
Brett Spaulding 1 year ago
parent dce3b47372
commit 2504740bd1

@ -13,7 +13,7 @@ class AlbumQueue extends Model
{ {
$result = false; $result = false;
$album_queued = AlbumQueue::where('album_id', $album->id)->first(); $album_queued = AlbumQueue::where('album_id', $album->id)->first();
if (is_null($album_queued) && $album->state === 'pending') { if (is_null($album_queued)) {
$this->album_id = $album->id; $this->album_id = $album->id;
$this->save(); $this->save();
$result = true; $result = true;
@ -25,6 +25,7 @@ class AlbumQueue extends Model
{ {
$queue = new AlbumQueue(); $queue = new AlbumQueue();
$queue->enqueue($album_id); $queue->enqueue($album_id);
return true;
} }
public function album() public function album()

@ -121,7 +121,8 @@ class WebScraper
'image' => $imageFileUrl, 'image' => $imageFileUrl,
]; ];
$album_id = Album::findOrCreateByName($artist, $albumTitle, $data); $album_id = Album::findOrCreateByName($artist, $albumTitle, $data);
AlbumQueue::addQueue($album_id); $queued = AlbumQueue::addQueue($album_id);
return $queued;
} }
/** /**
@ -140,7 +141,7 @@ class WebScraper
if ($albumBtn) { if ($albumBtn) {
\Log::info('Clicking on located Albums button..'); \Log::info('Clicking on located Albums button..');
$albumBtn[0]->click(); $albumBtn[0]->click();
sleep(3); sleep(5);
$itemsContainer = $driver->findElements(WebDriverBy::cssSelector('#items')); $itemsContainer = $driver->findElements(WebDriverBy::cssSelector('#items'));
foreach ($itemsContainer as $item) { foreach ($itemsContainer as $item) {
$albumContainers = $item->findElements(WebDriverBy::cssSelector('.ytmusic-grid-renderer')); $albumContainers = $item->findElements(WebDriverBy::cssSelector('.ytmusic-grid-renderer'));
@ -169,7 +170,7 @@ class WebScraper
if ($caroselNextButton[0]->isEnabled()) { if ($caroselNextButton[0]->isEnabled()) {
$action = $driver->action(); $action = $driver->action();
$action->moveToElement($caroselNextButton[0])->click()->perform(); $action->moveToElement($caroselNextButton[0])->click()->perform();
sleep(1); sleep(5);
} }
} }
} }

Loading…
Cancel
Save