When serialising an SDObject with lazy children, populate on-the-fly

* If an object has enoug children, the lazy generator can take multiple seconds
  on e.g. android to fully populate. This is a long enough stall to cause the
  host side to timeout while waiting for the next piece of data. Instead of
  populating everything up front before starting serialising, we now populate as
  we go for each child, so that there's a steadier stream of data and avoid any
  timeouts.
This commit is contained in:
baldurk
2021-06-25 15:51:43 +01:00
parent 6212e9876e
commit b8d7cd17ec
2 changed files with 41 additions and 39 deletions
+6
View File
@@ -375,6 +375,10 @@ private:
friend void DoSerialise(SerialiserType &ser, SDObjectData &el);
template <class SerialiserType>
friend void DoSerialise(SerialiserType &ser, SDObject *el);
template <class SerialiserType>
friend void DoSerialise(SerialiserType &ser, SDObject &el);
template <class SerialiserType>
friend void DoSerialise(SerialiserType &ser, SDChunk &el);
DOCUMENT("A list of :class:`SDObject` containing the children of this :class:`SDObject`.");
mutable StructuredObjectList children;
@@ -932,6 +936,8 @@ private:
friend void DoSerialise(SerialiserType &ser, SDObject &el);
template <class SerialiserType>
friend void DoSerialise(SerialiserType &ser, SDChunk &el);
template <class SerialiserType>
friend void DoSerialise(SerialiserType &ser, SDObject &el, StructuredObjectList &children);
void DeleteLazyGenerator() const
{