Clarify that if CAS fails we insert blocking.

This commit is contained in:
antirez 2025-03-26 23:41:55 +01:00
parent e3243819ef
commit c2d80e8ced

3
vset.c
View file

@ -407,6 +407,9 @@ int VADD_CASReply(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (ic == NULL ||
(newnode = hnsw_try_commit_insert(vset->hnsw, ic)) == NULL)
{
/* If we are here, the CAS insert failed. We need to insert
* again with full locking for neighbors selection and
* actual insertion. This time we can't fail: */
newnode = hnsw_insert(vset->hnsw, vec, NULL, 0, 0, nv, ef);
RedisModule_Assert(newnode != NULL);
} else {