File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1549,20 +1549,20 @@ def _search_by_id(
15491549 ** kwargs ,
15501550 ):
15511551 results .data .extend (page_results .data )
1552+ # try using crunch to get unique result and stop if found, to avoid unnecessary requests
1553+ if (
1554+ len (results ) > 1
1555+ and len (filtered := results .filter_property (id = uid )) == 1
1556+ ):
1557+ results = filtered
1558+ break
15521559 except Exception as e :
15531560 if kwargs .get ("raise_errors" ):
15541561 raise
15551562 logger .warning (e )
15561563 results .errors .append ((plugin .provider , e ))
15571564 continue
15581565
1559- # try using crunch to get unique result
1560- if (
1561- len (results ) > 1
1562- and len (filtered := results .filter_property (id = uid )) == 1
1563- ):
1564- results = filtered
1565-
15661566 if len (results ) == 1 :
15671567 if not results [0 ].collection :
15681568 # guess collection from properties
You can’t perform that action at this time.
0 commit comments