Пример #1
0
 public function executeWithLockedSend(Send $send, callable $func, $timeout = 60)
 {
     return DB::transaction(function () use($send, $func, $timeout) {
         return RecordLock::acquireAndExecute('xchain.send' . $send['id'], function () use($send, $func) {
             $locked_send = Send::where('id', $send['id'])->first();
             $out = $func($locked_send);
             // update $send in memory from any changes made to $locked_send
             $send->setRawAttributes($locked_send->getAttributes());
             return $out;
         }, $timeout);
     });
 }
Пример #2
0
 protected function clearDatabasesForScenario()
 {
     \App\Models\Block::truncate();
     \App\Models\Transaction::truncate();
     \App\Models\Notification::truncate();
     \App\Models\MonitoredAddress::truncate();
     \App\Models\PaymentAddress::truncate();
     \App\Models\Send::truncate();
     \App\Models\User::truncate();
     \App\Models\Account::truncate();
     \App\Models\APICall::truncate();
     \App\Models\LedgerEntry::truncate();
     return;
 }