0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-18 07:50:57 +01:00

ircd::json::stack::checkpoint: Trigger unforced flush from checkpoint dtor.

This commit is contained in:
Jason Volk 2020-04-15 15:59:03 -07:00
parent 2b6b69658b
commit 777ea844e7

View file

@ -1741,6 +1741,14 @@ noexcept
assert(s->cp == this); assert(s->cp == this);
s->cp = pc; s->cp = pc;
// Certain uses of json::stack in loops might create and destroy
// checkpoints without any appends between their lifetimes. This results
// in the buffer filling up and inevitably force-flushing under an unlucky
// checkpoint (which is bad). This non-forced flush here prevents that once
// the buffer reaches the low-watermark and there is no parent checkpoint.
if(committing())
s->flush();
} }
bool bool