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)
|
||||
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, _) ->
|
||||
push_ctxt(Ctxt),
|
||||
F();
|
||||
run_f(F, Ctxt, true, Alias) ->
|
||||
mrdb_mutex:do(
|
||||
Alias,
|
||||
fun() ->
|
||||
push_ctxt(incr_attempt(Ctxt)),
|
||||
F()
|
||||
end).
|
||||
mrdb_mutex:do(Alias, F).
|
||||
|
||||
incr_attempt(#{ activity := #{type := tx, attempt := A} = Act, db_ref := DbRef } = C) ->
|
||||
{ok, TxH} = rdb_transaction(DbRef, []),
|
||||
|
Loading…
x
Reference in New Issue
Block a user