Skip to content

Commit

Permalink
Read the length of pending records while locked
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Sep 15, 2023
1 parent 738944b commit 0e5ac83
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ func (u *upkeepStateStore) Start(pctx context.Context) error {
}

func (u *upkeepStateStore) flush(ctx context.Context) {
cloneRecords := make([]persistedStateRecord, len(u.pendingRecords))

u.mu.Lock()
cloneRecords := make([]persistedStateRecord, len(u.pendingRecords))
copy(cloneRecords, u.pendingRecords)
u.pendingRecords = []persistedStateRecord{}
u.mu.Unlock()
Expand Down

0 comments on commit 0e5ac83

Please sign in to comment.