How to flush pending operation buffer #12412
Unanswered
simon-abbott
asked this question in
Q&A
Replies: 1 comment
-
@simon-abbott there isn't currently a way to flush the buffer. However, you shouldn't need to flush the buffer after connecting - Mongoose only buffers commands before you initially connect (so before step 1). Try enabling Mongoose debug mode, Also, consider disabling |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have a bit of a conundrum. I'm trying to drop a temporary database after a test run, but it's still there after the test completes. I have traced the issue, and I believe what is happening is that the database is being dropped, but is then immediately being re-created by some buffered commands. Basically I think it's doing the following:
What I would like is a way to wait until the command buffer is empty, so I can move step 4 before step 3, but there I can't find a
flush
function (orwait
, orpause
, or anything else that would signal when the queue is empty). Is there a way to do this cleanly? The only way I've found so far is to sleep for a while (await new Promise((resolve) => setTimeout(resolve, 250));
) seems to do the trick), but I'd rather not wait for longer than necessary.I'd also rather not turn off buffering entirely. I know that's an option, but I do want buffering (plus our code is built assuming it's on, and I don't want to risk breaking anything), I just want to be able to flush the buffer manually.
Beta Was this translation helpful? Give feedback.
All reactions