Skip to content

Commit 1246de8

Browse files
authored
Merge pull request #1412 from 0chain/fix/commit-txn
create transaction after lock
2 parents 23b49b3 + 76c4fa7 commit 1246de8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/go/0chain.net/blobbercore/handler/handler_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ func GetBlobberInfoJson() BlobberInfo {
118118
// Should only be used for handlers where the writemarker is submitted
119119
func WithStatusConnectionForWM(handler common.StatusCodeResponderF) common.StatusCodeResponderF {
120120
return func(ctx context.Context, r *http.Request) (resp interface{}, statusCode int, err error) {
121-
ctx = GetMetaDataStore().CreateTransaction(ctx)
122121
allocationID := r.Header.Get(common.AllocationIdHeader)
123122
if allocationID == "" {
124123
return nil, http.StatusBadRequest, common.NewError("invalid_allocation_id", "Allocation ID is required")
@@ -134,6 +133,7 @@ func WithStatusConnectionForWM(handler common.StatusCodeResponderF) common.Statu
134133
}
135134
mutex.Lock()
136135
defer mutex.Unlock()
136+
ctx = GetMetaDataStore().CreateTransaction(ctx)
137137
tx := GetMetaDataStore().GetTransaction(ctx)
138138
resp, statusCode, err = handler(ctx, r)
139139

0 commit comments

Comments
 (0)