From 32e0d2376fe91e76be04bb62825af5d95737b13e Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 2 Oct 2018 19:44:54 +0200 Subject: [PATCH] streamAppendItem(): Update the radix tree pointer only if changed. --- src/t_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_stream.c b/src/t_stream.c index 1279d8fa..7dcd18f4 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -349,7 +349,8 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_ lp = lpAppendInteger(lp,lp_count); /* Insert back into the tree in order to update the listpack pointer. */ - raxInsert(s->rax,(unsigned char*)&rax_key,sizeof(rax_key),lp,NULL); + if (ri.data != lp) + raxInsert(s->rax,(unsigned char*)&rax_key,sizeof(rax_key),lp,NULL); s->length++; s->last_id = id; if (added_id) *added_id = id;