Skip to content

Commit 388b9ba

Browse files
committed
replaced uniqueness with flags
1 parent 9a0505a commit 388b9ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Services/StateService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ public function persist(Wallet $wallet): void
2929

3030
public function commit(): void
3131
{
32-
foreach (array_unique($this->wallets) as $wallet) {
33-
$this->bookkeeperService->increase($wallet, $this->regulatorService->diff($wallet));
32+
$flags = [];
33+
foreach ($this->wallets as $wallet) {
34+
if ($flags[$wallet->uuid] ?? true) {
35+
$this->bookkeeperService->increase($wallet, $this->regulatorService->diff($wallet));
36+
$flags[$wallet->uuid] = false;
37+
}
3438
}
3539

3640
$this->purge();

0 commit comments

Comments
 (0)