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
333
333
334
334
// Update the DB with the delta changes to the memory account state
335
335
var wg sync.WaitGroup
336
+ var cachedMemoryAccountStateUpdateMu sync.Mutex
336
337
for _ , dbUpdate := range dbUpdates {
337
338
wg .Add (1 )
338
339
@@ -360,7 +361,9 @@ func (h *MemoryAccountWithDataUpdateHandler) onStateObserved(ctx context.Context
360
361
err := h .ramStore .Save (ctx , record )
361
362
switch err {
362
363
case nil :
364
+ cachedMemoryAccountStateUpdateMu .Lock ()
363
365
h.cachedMemoryAccountState [base58MemoryAccountAddress ][dbUpdate.Index ] = dbUpdate
366
+ cachedMemoryAccountStateUpdateMu .Unlock ()
364
367
case ram .ErrStaleState :
365
368
// Should never happen given current locking structure
366
369
default :
You can’t perform that action at this time.
0 commit comments