File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ func (h *MemoryAccountWithDataUpdateHandler) onStateObserved(ctx context.Context
333333
334334 // Update the DB with the delta changes to the memory account state
335335 var wg sync.WaitGroup
336+ var cachedMemoryAccountStateUpdateMu sync.Mutex
336337 for _ , dbUpdate := range dbUpdates {
337338 wg .Add (1 )
338339
@@ -360,7 +361,9 @@ func (h *MemoryAccountWithDataUpdateHandler) onStateObserved(ctx context.Context
360361 err := h .ramStore .Save (ctx , record )
361362 switch err {
362363 case nil :
364+ cachedMemoryAccountStateUpdateMu .Lock ()
363365 h.cachedMemoryAccountState [base58MemoryAccountAddress ][dbUpdate.Index ] = dbUpdate
366+ cachedMemoryAccountStateUpdateMu .Unlock ()
364367 case ram .ErrStaleState :
365368 // Should never happen given current locking structure
366369 default :
You can’t perform that action at this time.
0 commit comments