Skip to content

Commit 8b597c3

Browse files
committed
update docs
1 parent 66a1308 commit 8b597c3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/transaction.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
## Transaction
22

3+
> Starting from version 9.6 you can safely use standard framework transactions.
4+
5+
You definitely need to know the feature of transactions. The wallet is automatically blocked from the moment it is used until the end of the transaction. Therefore, it is necessary to use the wallet closer to the end of the transaction.
6+
7+
Very important! Almost all wallet transactions are blocking.
8+
9+
```php
10+
use Illuminate\Support\Facades\DB;
11+
12+
DB::beginTransaction();
13+
$wallet->balanceInt; // now the wallet is blocked
14+
doingMagic(); // running for a long time.
15+
DB::commit(); // here will unlock the wallet
16+
```
17+
18+
The point is that you need to minimize operations within transactions as much as possible. The longer the transaction, the longer the wallet lock.
19+
The maximum wallet blocking time is set in the configuration. The longer the transaction takes, the more likely it is to get a race for the wallet.
20+
21+
---
22+
23+
If you are using a version below 9.6, then the following is relevant for you:
24+
--
25+
326
> Since version 9.2 it is safer to use AtomicServiceInterface.
427
528
> Is it possible to use laravel's inline transactions? No, It is Immpossible. This limitation is due to the internal architecture of the package. To achieve the maximum speed of work, work with an internal state of balance was needed. Starting with version 8.2, a special error has appeared that will inform you about incorrect work with the `TransactionStartException` package.

0 commit comments

Comments
 (0)