@@ -168,13 +168,15 @@ def _find_existing_compatible_binaries(self, node, compatibles, remotes, update)
168168                self ._compatible_found (conanfile , package_id , compatible_package )
169169                return 
170170        if  not  should_update_reference (conanfile .ref , update ):
171-             conanfile .output .info (f"Compatible configurations not found in cache, checking servers" )
171+             remotes_to_check  =  self ._filter_compat_remotes (node , remotes )
172+             conanfile .output .info ("Compatible configurations not found in cache, " 
173+                                   f"checking { len (remotes_to_check )}  )
172174            for  package_id , compatible_package  in  compatibles .items ():
173175                conanfile .output .info (f"'{ package_id }  
174176                                      f"{ conanfile .info .dump_diff (compatible_package )}  )
175177                node ._package_id  =  package_id   # Modifying package id under the hood, FIXME 
176178                node .binary  =  None   # Invalidate it 
177-                 self ._evaluate_download (node , remotes , update )
179+                 self ._evaluate_download (node , remotes_to_check , update )
178180                if  node .binary  ==  BINARY_DOWNLOAD :
179181                    self ._compatible_found (conanfile , package_id , compatible_package )
180182                    return 
@@ -199,6 +201,24 @@ def _find_build_compatible_binary(self, node, compatibles):
199201        node .binary  =  original_binary 
200202        node ._package_id  =  original_package_id 
201203
204+     def  _filter_compat_remotes (self , node , remotes ):
205+         # For each node, check if the remote contains the recipe, 
206+         # so that we can skip checking for packages in remotes that don't have the recipe 
207+         # TODO: Cache this, but make sure to reset when changing remotes 
208+         remotes_to_check  =  []
209+         for  remote  in  remotes :
210+             try :
211+                 self ._remote_manager .get_recipe_revision_reference (node .ref , remote )
212+                 remotes_to_check .append (remote )
213+             except  NotFoundException :
214+                 continue 
215+             except  ConanConnectionError :
216+                 node .conanfile .output .error (f"Failed checking for recipe '{ node .ref }  
217+                                             f"'{ remote .name }  )
218+                 raise 
219+ 
220+         return  remotes_to_check 
221+ 
202222    def  _evaluate_node (self , node , build_mode , remotes , update ):
203223        assert  node .binary  is  None , "Node.binary should be None" 
204224        assert  node .package_id  is  not None , "Node.package_id shouldn't be None" 
0 commit comments