A small PR for the HTTP handler that updates a profile card was reviewed. The handler accepts JSON, saves a short user description, and starts a background update of derived text for search. After the changes, behavior became unstable under request cancellation and under load.
POST /profiles/refresh accepts JSON of the form {"user_id":"u1","bio":"text"}.202 Accepted and JSON {"status":"scheduled"}.499.before and after in the changed files.Store instance from multiple goroutine.httptest.NewRequest(...).WithContext(ctx).Store does not change and background work does not start.Example payload:
{"user_id":"u1","bio":"new bio"}
Store state must be synchronized for reads and writes.go test -race.1.24net/http HTTP handler, background work via goroutineStore may be used by many concurrent requests; all access to the shared map must be protected by the same sync.RWMutexPOST /profiles/refresh, JSON body with user_id and bio fields, responses 202, 400, or 499go test -race ./...Use line comments to explain the problem, its impact, the fix and how to test it.