Tx push at retry before mutex instead of after
This commit is contained in:
parent
ab15b7f399
commit
8073a0daa5
@ -290,16 +290,13 @@ do_activity(F, Alias, Ctxt, WithLock) ->
|
|||||||
abort_and_pop(Cat, Err)
|
abort_and_pop(Cat, Err)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec run_f(_, #{'activity':=#{'handle':=_, 'type':='batch' | 'tx', 'attempt'=>1, 'no_snapshot'=>boolean(), 'retries'=>non_neg_integer(), _=>_}, 'alias':=_, 'db_ref':=_, 'no_snapshot'=>boolean(), 'retries'=>non_neg_integer(), _=>_}, boolean(), _) -> any().
|
||||||
run_f(F, Ctxt, false, _) ->
|
run_f(F, Ctxt, false, _) ->
|
||||||
push_ctxt(Ctxt),
|
push_ctxt(Ctxt),
|
||||||
F();
|
F();
|
||||||
run_f(F, Ctxt, true, Alias) ->
|
run_f(F, Ctxt, true, Alias) ->
|
||||||
mrdb_mutex:do(
|
|
||||||
Alias,
|
|
||||||
fun() ->
|
|
||||||
push_ctxt(incr_attempt(Ctxt)),
|
push_ctxt(incr_attempt(Ctxt)),
|
||||||
F()
|
mrdb_mutex:do(Alias, F).
|
||||||
end).
|
|
||||||
|
|
||||||
incr_attempt(#{ activity := #{type := tx, attempt := A} = Act, db_ref := DbRef } = C) ->
|
incr_attempt(#{ activity := #{type := tx, attempt := A} = Act, db_ref := DbRef } = C) ->
|
||||||
{ok, TxH} = rdb_transaction(DbRef, []),
|
{ok, TxH} = rdb_transaction(DbRef, []),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user