File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1799,14 +1799,11 @@ def __hash__(self):
17991799
18001800 def __eq__ (self , other ):
18011801 if isinstance (other , Endpoint ):
1802- # Check if the contents of the endpoint match
18031802 contents_match = str (self ) == str (other )
1804- # Determine if products should be used in the equation
1805- if self .product is not None and other .product is not None :
1806- # Check if the products are the same
1807- products_match = (self .product ) == other .product
1808- # Check if the contents match
1809- return products_match and contents_match
1803+ # Use product_id (cached integer) instead of self.product to avoid
1804+ # triggering a FK lookup on every comparison inside NestedObjects.add_edge.
1805+ if self .product_id is not None and other .product_id is not None :
1806+ return self .product_id == other .product_id and contents_match
18101807 return contents_match
18111808
18121809 return NotImplemented
You can’t perform that action at this time.
0 commit comments