示例#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
 public function releasePaymentAddressLock(PaymentAddress $payment_address)
 {
     return RecordLock::release($payment_address['uuid']);
 }