This repository was archived by the owner on Feb 1, 2023. It is now read-only.
File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -900,6 +900,16 @@ function () use ($entry) {
900
900
901
901
$ results = $ this ->reverseSearchFuzzySearch ($ this ->PATH_IMAGES . '/ ' . $ entry );
902
902
903
+ if (isset ($ results ['error ' ]) && $ results ['error ' ] === 'ShortLimitReached ' ) {
904
+ $ results = $ this ->applyCooldown (
905
+ 60 ,
906
+ $ results ,
907
+ function () use ($ entry ) {
908
+ return $ this ->reverseSearchFuzzySearch ($ this ->PATH_IMAGES . '/ ' . $ entry );
909
+ }
910
+ );
911
+ }
912
+
903
913
if ($ this ->FORCE_MULTI_SEARCH ) {
904
914
if (isset ($ results_prev ) && isset ($ service_prev ) && $ results_prev !== null ) {
905
915
/** @noinspection SlowArrayOperationsInLoopInspection */
@@ -1580,6 +1590,11 @@ private function reverseSearchFuzzySearch($file)
1580
1590
1581
1591
$ result = json_decode ($ output , true );
1582
1592
1593
+ $ http_code = curl_getinfo ($ ch , CURLINFO_HTTP_CODE );
1594
+ if ($ http_code === 429 || (isset ($ result ['code ' ]) && $ result ['code ' ] === 429 )) {
1595
+ return ['error ' => 'ShortLimitReached ' ];
1596
+ }
1597
+
1583
1598
$ matches = [];
1584
1599
if (isset ($ result ['matches ' ]) && count ($ result ['matches ' ]) > 0 ) {
1585
1600
foreach ($ result ['matches ' ] as $ this_result ) {
You can’t perform that action at this time.
0 commit comments