Protecting against infinite loops on loading relationships
In my business domain I need to richly relate (i.e. with data on the relationship a resource with any number of resources of the same kind. I do this using a 'connector' resource, where the resource has_many connector forward_relationships and reverse_relationships, and the connector belongs to each of a source and target resource.
So the source resource forward_relationship[]'s run through the connector resource an appear as reverse_relationship on the target. This enables me to model forward and reverse relationships independently, which is useful since they have independent lifecycles.
The problem I'm having is that when I establish both forward and reverse relationships, if I have a load statement that loads relationships, then Ash will loop infinitely, exercising the datalayer over and over as it recursively loads resources it has recently loaded. As I mentioned the source and target resource are the same resource kind, so are constrained to have the same load statement.
I'm open to suggestions about best practice, but I feel I should be able to model my domain as it really is.
Have people encountered this/how do they avoid/deal with it?
Should Ash protect against infinite looping by some mechanism, since this is effectively worse than an application crash since harder to detect and consumes resources.
So the source resource forward_relationship[]'s run through the connector resource an appear as reverse_relationship on the target. This enables me to model forward and reverse relationships independently, which is useful since they have independent lifecycles.
The problem I'm having is that when I establish both forward and reverse relationships, if I have a load statement that loads relationships, then Ash will loop infinitely, exercising the datalayer over and over as it recursively loads resources it has recently loaded. As I mentioned the source and target resource are the same resource kind, so are constrained to have the same load statement.
I'm open to suggestions about best practice, but I feel I should be able to model my domain as it really is.
Have people encountered this/how do they avoid/deal with it?
Should Ash protect against infinite looping by some mechanism, since this is effectively worse than an application crash since harder to detect and consumes resources.
