From 75abb294c0a0f03f40cb4e6cad8a6084e1f3fe43 Mon Sep 17 00:00:00 2001 From: ykomissarov Date: Thu, 9 Jan 2020 18:00:02 +0300 Subject: [PATCH] fix race --- accounting/storing_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accounting/storing_test.go b/accounting/storing_test.go index f791002..978626c 100644 --- a/accounting/storing_test.go +++ b/accounting/storing_test.go @@ -103,7 +103,9 @@ type requestsRepository struct { } func (r *requestsRepository) Insert(model []entity.Request) error { + r.mx.Lock() r.cache = append(r.cache, model...) + r.mx.Unlock() r.wg.Done() return nil }