def _stream()

in aws_xray_sdk/core/streaming/default_streaming.py [0:0]


    def _stream(self, entity, callback):
        children = entity.subsegments

        children_ready = []
        if len(children) > 0:
            for child in children:
                if self._stream(child, callback):
                    children_ready.append(child)

        # If all children subtrees and this root are ready, don't stream yet.
        # Mark this root ready and return to parent.
        if len(children_ready) == len(children) and not entity.in_progress:
            return True

        # Otherwise stream all ready children subtrees and return False
        for child in children_ready:
            callback(child)
            entity.remove_subsegment(child)

        return False