mulit: increase logprogress time
Switched the batchsize to 30 seconds instead of number of payments and invoices.
This commit is contained in:
4 files changed
+66
-34
No files matched your search
+23
-12
@@ -143,9 +143,9 @@ const (
|
|||||||
ampStateCircuitKeysType tlv.Type = 4
|
ampStateCircuitKeysType tlv.Type = 4
|
||||||
ampStateAmtPaidType tlv.Type = 5
|
ampStateAmtPaidType tlv.Type = 5
|
||||||
|
|
||||||
// invoiceScanBatchSize is the number we use limiting the logging output
|
// invoiceProgressLogInterval is the interval we use limiting the
|
||||||
// of invoice processing.
|
// logging output of invoice processing.
|
||||||
invoiceScanBatchSize = 1000
|
invoiceProgressLogInterval = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddInvoice inserts the targeted invoice into the database. If the invoice has
|
// AddInvoice inserts the targeted invoice into the database. If the invoice has
|
||||||
@@ -248,6 +248,7 @@ func (d *DB) InvoicesAddedSince(_ context.Context, sinceAddIndex uint64) (
|
|||||||
var (
|
var (
|
||||||
newInvoices []invpkg.Invoice
|
newInvoices []invpkg.Invoice
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
lastLogTime = time.Now()
|
||||||
processedCount int
|
processedCount int
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -294,10 +295,14 @@ func (d *DB) InvoicesAddedSince(_ context.Context, sinceAddIndex uint64) (
|
|||||||
newInvoices = append(newInvoices, invoice)
|
newInvoices = append(newInvoices, invoice)
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%invoiceScanBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
log.Debugf("Processed %d invoices since "+
|
invoiceProgressLogInterval {
|
||||||
"invoice with add index %v",
|
|
||||||
|
log.Debugf("Processed %d invoices which "+
|
||||||
|
"were added since add index %v",
|
||||||
processedCount, sinceAddIndex)
|
processedCount, sinceAddIndex)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +315,7 @@ func (d *DB) InvoicesAddedSince(_ context.Context, sinceAddIndex uint64) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
log.Debugf("Completed scanning invoices added since index %v: "+
|
log.Debugf("Completed scanning for invoices added since index %v: "+
|
||||||
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
||||||
sinceAddIndex, processedCount, len(newInvoices),
|
sinceAddIndex, processedCount, len(newInvoices),
|
||||||
elapsed.Round(time.Millisecond))
|
elapsed.Round(time.Millisecond))
|
||||||
@@ -1068,6 +1073,7 @@ func (d *DB) InvoicesSettledSince(_ context.Context, sinceSettleIndex uint64) (
|
|||||||
var (
|
var (
|
||||||
settledInvoices []invpkg.Invoice
|
settledInvoices []invpkg.Invoice
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
lastLogTime = time.Now()
|
||||||
processedCount int
|
processedCount int
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1130,10 +1136,15 @@ func (d *DB) InvoicesSettledSince(_ context.Context, sinceSettleIndex uint64) (
|
|||||||
settledInvoices = append(settledInvoices, invoice)
|
settledInvoices = append(settledInvoices, invoice)
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%invoiceScanBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
|
invoiceProgressLogInterval {
|
||||||
|
|
||||||
log.Debugf("Processed %d settled invoices "+
|
log.Debugf("Processed %d settled invoices "+
|
||||||
"since invoice with settle index %v",
|
"which have a settle index greater "+
|
||||||
processedCount, sinceSettleIndex)
|
"than %v", processedCount,
|
||||||
|
sinceSettleIndex)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,8 +1157,8 @@ func (d *DB) InvoicesSettledSince(_ context.Context, sinceSettleIndex uint64) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
log.Debugf("Completed scanning invoices settled since index %v: "+
|
log.Debugf("Completed scanning for settled invoices starting at "+
|
||||||
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
"index %v: total_processed=%d, found_invoices=%d, elapsed=%v",
|
||||||
sinceSettleIndex, processedCount, len(settledInvoices),
|
sinceSettleIndex, processedCount, len(settledInvoices),
|
||||||
elapsed.Round(time.Millisecond))
|
elapsed.Round(time.Millisecond))
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ const (
|
|||||||
// payment sequences for future payments.
|
// payment sequences for future payments.
|
||||||
paymentSeqBlockSize = 1000
|
paymentSeqBlockSize = 1000
|
||||||
|
|
||||||
// paymentBatchSize is the number we use limiting the logging output
|
// paymentProgressLogInterval is the interval we use limiting the
|
||||||
// of payment processing.
|
// logging output of payment processing.
|
||||||
paymentBatchSize = 1000
|
paymentProgressLogInterval = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -778,6 +778,7 @@ func (p *PaymentControl) FetchInFlightPayments() ([]*MPPayment, error) {
|
|||||||
var (
|
var (
|
||||||
inFlights []*MPPayment
|
inFlights []*MPPayment
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
lastLogTime = time.Now()
|
||||||
processedCount int
|
processedCount int
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -799,11 +800,15 @@ func (p *PaymentControl) FetchInFlightPayments() ([]*MPPayment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%paymentBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
|
paymentProgressLogInterval {
|
||||||
|
|
||||||
log.Debugf("Scanning inflight payments "+
|
log.Debugf("Scanning inflight payments "+
|
||||||
"(in progress), processed %d, last "+
|
"(in progress), processed %d, last "+
|
||||||
"processed payment: %v", processedCount,
|
"processed payment: %v", processedCount,
|
||||||
p.Info)
|
p.Info)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip the payment if it's terminated.
|
// Skip the payment if it's terminated.
|
||||||
@@ -822,8 +827,9 @@ func (p *PaymentControl) FetchInFlightPayments() ([]*MPPayment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
log.Debugf("Completed scanning inflight payments: total_processed=%d, "+
|
log.Debugf("Completed scanning for inflight payments: "+
|
||||||
"found_inflight=%d, elapsed=%v", processedCount, len(inFlights),
|
"total_processed=%d, found_inflight=%d, elapsed=%v",
|
||||||
|
processedCount, len(inFlights),
|
||||||
elapsed.Round(time.Millisecond))
|
elapsed.Round(time.Millisecond))
|
||||||
|
|
||||||
return inFlights, nil
|
return inFlights, nil
|
||||||
|
|||||||
@@ -202,10 +202,10 @@ type PaymentCreationInfo struct {
|
|||||||
FirstHopCustomRecords lnwire.CustomRecords
|
FirstHopCustomRecords lnwire.CustomRecords
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a human-readable description of the payment creation info.
|
||||||
func (p *PaymentCreationInfo) String() string {
|
func (p *PaymentCreationInfo) String() string {
|
||||||
return fmt.Sprintf("payment_id=%v, amount=%v, created_at=%v, "+
|
return fmt.Sprintf("payment_id=%v, amount=%v, created_at=%v",
|
||||||
"payment_request=%v", p.PaymentIdentifier, p.Value,
|
p.PaymentIdentifier, p.Value, p.CreationTime)
|
||||||
p.CreationTime, p.PaymentRequest)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// htlcBucketKey creates a composite key from prefix and id where the result is
|
// htlcBucketKey creates a composite key from prefix and id where the result is
|
||||||
|
|||||||
+28
-13
@@ -25,9 +25,9 @@ const (
|
|||||||
// queries to limit the number of rows returned.
|
// queries to limit the number of rows returned.
|
||||||
defaultQueryPaginationLimit = 100
|
defaultQueryPaginationLimit = 100
|
||||||
|
|
||||||
// invoiceScanBatchSize is the number we use limiting the logging output
|
// invoiceProgressLogInterval is the interval we use limiting the
|
||||||
// when scanning invoices.
|
// logging output of invoice processing.
|
||||||
invoiceScanBatchSize = 1000
|
invoiceProgressLogInterval = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// SQLInvoiceQueries is an interface that defines the set of operations that can
|
// SQLInvoiceQueries is an interface that defines the set of operations that can
|
||||||
@@ -792,6 +792,7 @@ func (i *SQLStore) InvoicesSettledSince(ctx context.Context, idx uint64) (
|
|||||||
var (
|
var (
|
||||||
invoices []Invoice
|
invoices []Invoice
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
lastLogTime = time.Now()
|
||||||
processedCount int
|
processedCount int
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -829,11 +830,15 @@ func (i *SQLStore) InvoicesSettledSince(ctx context.Context, idx uint64) (
|
|||||||
invoices = append(invoices, *invoice)
|
invoices = append(invoices, *invoice)
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%invoiceScanBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
|
invoiceProgressLogInterval {
|
||||||
|
|
||||||
log.Debugf("Processed %d settled "+
|
log.Debugf("Processed %d settled "+
|
||||||
"invoices since invoice with "+
|
"invoices which have a settle "+
|
||||||
"settle index %v",
|
"index greater than %v",
|
||||||
processedCount, idx)
|
processedCount, idx)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -891,10 +896,15 @@ func (i *SQLStore) InvoicesSettledSince(ctx context.Context, idx uint64) (
|
|||||||
invoices = append(invoices, *invoice)
|
invoices = append(invoices, *invoice)
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%invoiceScanBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
|
invoiceProgressLogInterval {
|
||||||
|
|
||||||
log.Debugf("Processed %d settled invoices "+
|
log.Debugf("Processed %d settled invoices "+
|
||||||
"since invoice with settle index %v",
|
"including AMP sub invoices which "+
|
||||||
|
"have a settle index greater than %v",
|
||||||
processedCount, idx)
|
processedCount, idx)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,8 +918,8 @@ func (i *SQLStore) InvoicesSettledSince(ctx context.Context, idx uint64) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
log.Debugf("Completed scanning invoices settled since index %v: "+
|
log.Debugf("Completed scanning for settled invoices starting at "+
|
||||||
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
"index %v: total_processed=%d, found_invoices=%d, elapsed=%v",
|
||||||
idx, processedCount, len(invoices),
|
idx, processedCount, len(invoices),
|
||||||
elapsed.Round(time.Millisecond))
|
elapsed.Round(time.Millisecond))
|
||||||
|
|
||||||
@@ -928,6 +938,7 @@ func (i *SQLStore) InvoicesAddedSince(ctx context.Context, idx uint64) (
|
|||||||
var (
|
var (
|
||||||
result []Invoice
|
result []Invoice
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
|
lastLogTime = time.Now()
|
||||||
processedCount int
|
processedCount int
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -963,10 +974,14 @@ func (i *SQLStore) InvoicesAddedSince(ctx context.Context, idx uint64) (
|
|||||||
result = append(result, *invoice)
|
result = append(result, *invoice)
|
||||||
|
|
||||||
processedCount++
|
processedCount++
|
||||||
if processedCount%invoiceScanBatchSize == 0 {
|
if time.Since(lastLogTime) >=
|
||||||
|
invoiceProgressLogInterval {
|
||||||
|
|
||||||
log.Debugf("Processed %d invoices "+
|
log.Debugf("Processed %d invoices "+
|
||||||
"added since invoice with add "+
|
"which were added since add "+
|
||||||
"index %v", processedCount, idx)
|
"index %v", processedCount, idx)
|
||||||
|
|
||||||
|
lastLogTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,7 +997,7 @@ func (i *SQLStore) InvoicesAddedSince(ctx context.Context, idx uint64) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
log.Debugf("Completed scanning invoices added since index %v: "+
|
log.Debugf("Completed scanning for invoices added since index %v: "+
|
||||||
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
"total_processed=%d, found_invoices=%d, elapsed=%v",
|
||||||
idx, processedCount, len(result),
|
idx, processedCount, len(result),
|
||||||
elapsed.Round(time.Millisecond))
|
elapsed.Round(time.Millisecond))
|
||||||
|
|||||||
Reference in new issue
Block a user