guards and safety timeouts around paymentChecker intervals.

This commit is contained in:
fiatjaf 2020-10-15 12:32:28 -03:00
parent bdbb58b2b0
commit c81e61e4fe

View file

@ -300,6 +300,10 @@ new Vue({
} }
} }
clearInterval(this.receive.paymentChecker)
setTimeout(() => {
clearInterval(this.receive.paymentChecker)
}, 40000)
this.receive.paymentChecker = setInterval(() => { this.receive.paymentChecker = setInterval(() => {
let hash = response.data.payment_hash let hash = response.data.payment_hash
@ -428,6 +432,10 @@ new Vue({
LNbits.api LNbits.api
.payInvoice(this.g.wallet, this.parse.data.request) .payInvoice(this.g.wallet, this.parse.data.request)
.then(response => { .then(response => {
clearInterval(this.parse.paymentChecker)
setTimeout(() => {
clearInterval(this.parse.paymentChecker)
}, 40000)
this.parse.paymentChecker = setInterval(() => { this.parse.paymentChecker = setInterval(() => {
LNbits.api LNbits.api
.getPayment(this.g.wallet, response.data.payment_hash) .getPayment(this.g.wallet, response.data.payment_hash)
@ -465,6 +473,10 @@ new Vue({
.then(response => { .then(response => {
this.parse.show = false this.parse.show = false
clearInterval(this.parse.paymentChecker)
setTimeout(() => {
clearInterval(this.parse.paymentChecker)
}, 40000)
this.parse.paymentChecker = setInterval(() => { this.parse.paymentChecker = setInterval(() => {
LNbits.api LNbits.api
.getPayment(this.g.wallet, response.data.payment_hash) .getPayment(this.g.wallet, response.data.payment_hash)