Skip to content

[Bug]: In concurrent scenarios, there is a high possibility of repeatedly creating memory #153

@Ripcord55

Description

@Ripcord55

Describe the bug

When creating memory concurrently, there is a high probability of creating duplicate memories, such as those with the same user_id or document.
Image

Environment

0.3.0

Fast reproduce steps

1、Create a Lua script file
vim create_memory.lua

counter = 0
  
request = function()
   counter = counter + 1
   wrk.method = "POST"
   wrk.body = '{"content":"Alice likes coffee","user_id":"user' .. counter .. '","agent_id":"agent1","run_id":"run1","metadata":{"key":"value"},"infer":true}'
   wrk.headers["X-API-Key"] = "key1"
   wrk.headers["Content-Type"] = "application/json"
   return wrk.format(nil)
end

2、Use wrk to call Lua scripts for concurrent testing
wrk -t4 -c50 -d1s -s create_memory.lua http://localhost:8000/api/v1/memories

Expected behavior

No repetitive memorization

Actual behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions