From dc3df89aa73d9df48f92b22378a1307b4ddba3c7 Mon Sep 17 00:00:00 2001 From: horus Date: Wed, 23 Sep 2020 14:33:19 +0200 Subject: only save stats if no error --- app/Libraries/Background.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/Libraries') diff --git a/app/Libraries/Background.php b/app/Libraries/Background.php index 2d63a3e..5334480 100644 --- a/app/Libraries/Background.php +++ b/app/Libraries/Background.php @@ -149,9 +149,10 @@ class Background { echo "Getting stats for " . $entry->mal_id ."\n"; $animeStats = new AnimeStats(); - $animeStats->fill( $entry->mal_id ); - - $animeStats->save(); + if ( $animeStats->fill($entry->mal_id) ) { + # Only save if no error + $animeStats->save(); + } # sleep to avoid 403 sleep(5); -- cgit v1.2.3