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