[#1024] blobovnicza: Copy data on iterate
Some checks failed
Vulncheck / Vulncheck (pull_request) Failing after 1m41s
DCO action / DCO (pull_request) Successful in 1m48s
Build / Build Components (1.21) (pull_request) Successful in 2m52s
Tests and linters / Tests (1.20) (pull_request) Failing after 2m39s
Build / Build Components (1.20) (pull_request) Failing after 3m2s
Tests and linters / Staticcheck (pull_request) Failing after 3m43s
Tests and linters / Lint (pull_request) Failing after 4m26s
Tests and linters / Tests (1.21) (pull_request) Failing after 7m35s
Tests and linters / Tests with -race (pull_request) Failing after 8m9s
Some checks failed
Vulncheck / Vulncheck (pull_request) Failing after 1m41s
DCO action / DCO (pull_request) Successful in 1m48s
Build / Build Components (1.21) (pull_request) Successful in 2m52s
Tests and linters / Tests (1.20) (pull_request) Failing after 2m39s
Build / Build Components (1.20) (pull_request) Failing after 3m2s
Tests and linters / Staticcheck (pull_request) Failing after 3m43s
Tests and linters / Lint (pull_request) Failing after 4m26s
Tests and linters / Tests (1.21) (pull_request) Failing after 7m35s
Tests and linters / Tests with -race (pull_request) Failing after 8m9s
DB value is only valid while the tx is alive. But handler may to run something in other goroutine. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
044fe860df
commit
fdd191516f
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package blobovnicza
|
package blobovnicza
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
@ -159,7 +160,7 @@ func (b *Blobovnicza) Iterate(ctx context.Context, prm IteratePrm) (IterateRes,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !prm.withoutData {
|
if !prm.withoutData {
|
||||||
elem.data = v
|
elem.data = bytes.Clone(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
return prm.handler(elem)
|
return prm.handler(elem)
|
||||||
|
|
Loading…
Add table
Reference in a new issue