Fix crash on shutdown command

Former-commit-id: d72b5fa16df0c41dd62b8b6d25c1c2c9cce8b413
This commit is contained in:
John Sully 2021-01-31 02:30:28 +00:00
parent 7ad562c41a
commit 78b87d4ed1
2 changed files with 4 additions and 0 deletions

View File

@ -3295,6 +3295,8 @@ void flushSlavesOutputBuffers(void) {
listIter li;
listNode *ln;
flushReplBacklogToClients();
listRewind(g_pserver->slaves,&li);
while((ln = listNext(&li))) {
client *replica = (client*)listNodeValue(ln);

View File

@ -4203,6 +4203,8 @@ int prepareForShutdown(int flags) {
/* Best effort flush of replica output buffers, so that we hopefully
* send them pending writes. */
flushSlavesOutputBuffers();
g_pserver->repl_batch_idxStart = -1;
g_pserver->repl_batch_offStart = -1;
/* Close the listening sockets. Apparently this allows faster restarts. */
closeListeningSockets(1);