domino icon indicating copy to clipboard operation
domino copied to clipboard

[Package] - Limit display result size for pieces

Open vinicvaz opened this issue 1 year ago • 0 comments

We aim to restrict the size of data stored in the BasePiece.display_result property, as these values are transmitted to the frontend for UI rendering. Allowing excessively large data might lead to performance issues in front-to-back communication. To prevent this, maybe we can limit the display_result property to a specific number of bytes. This ensures that developers working on new pieces won't inadvertently save excessively large data, thereby mitigating potential performance problems.

Something like this would solve:

    @property
    def display_result(self):
       return self._display_result

    @display_result.setter
    def display_result(self, value):
        max_bytes = 10
        if size_in_bytes(value) > max_bytes:
             raise SomeException
        self._display_result = value

vinicvaz avatar Nov 27 '23 10:11 vinicvaz