diff --git a/blockbook.go b/blockbook.go index f5ecf015..44d8def9 100644 --- a/blockbook.go +++ b/blockbook.go @@ -65,6 +65,7 @@ var ( noTxCache = flag.Bool("notxcache", false, "disable tx cache") computeColumnStats = flag.Bool("computedbstats", false, "compute column stats and exit") + dbStatsPeriodHours = flag.Int("dbstatsperiod", 24, "period of db stats collection in hours, 0 disables stats collection") // resync index at least each resyncIndexPeriodMs (could be more often if invoked by message from ZeroMQ) resyncIndexPeriodMs = flag.Int("resyncindexperiod", 935093, "resync index period in milliseconds") @@ -459,13 +460,17 @@ func storeInternalStateLoop() { }() var computeRunning bool lastCompute := time.Now() - // randomize the duration between ComputeInternalStateColumnStats to avoid peaks after reboot of machine with multiple blockbooks - computePeriod := 23*time.Hour + time.Duration(rand.Float64()*float64((4*time.Hour).Nanoseconds())) lastAppInfo := time.Now() logAppInfoPeriod := 15 * time.Minute - glog.Info("storeInternalStateLoop starting with db stats recompute period ", computePeriod) + // randomize the duration between ComputeInternalStateColumnStats to avoid peaks after reboot of machine with multiple blockbooks + computePeriod := time.Duration(*dbStatsPeriodHours)*time.Hour + time.Duration(rand.Float64()*float64((4*time.Hour).Nanoseconds())) + if (*dbStatsPeriodHours) > 0 { + glog.Info("storeInternalStateLoop starting with db stats recompute period ", computePeriod) + } else { + glog.Info("storeInternalStateLoop starting with db stats compute disabled") + } tickAndDebounce(storeInternalStatePeriodMs*time.Millisecond, (storeInternalStatePeriodMs-1)*time.Millisecond, chanStoreInternalState, func() { - if !computeRunning && lastCompute.Add(computePeriod).Before(time.Now()) { + if (*dbStatsPeriodHours) > 0 && !computeRunning && lastCompute.Add(computePeriod).Before(time.Now()) { computeRunning = true go func() { err := index.ComputeInternalStateColumnStats(stopCompute) diff --git a/configs/coins/bitcoin.json b/configs/coins/bitcoin.json index ab5c34a8..1532fd53 100644 --- a/configs/coins/bitcoin.json +++ b/configs/coins/bitcoin.json @@ -22,10 +22,10 @@ "package_name": "backend-bitcoin", "package_revision": "satoshilabs-1", "system_user": "bitcoin", - "version": "0.17.0", - "binary_url": "https://bitcoin.org/bin/bitcoin-core-0.17.0/bitcoin-0.17.0-x86_64-linux-gnu.tar.gz", + "version": "0.17.1", + "binary_url": "https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz", "verification_type": "gpg-sha256", - "verification_source": "https://bitcoin.org/bin/bitcoin-core-0.17.0/SHA256SUMS.asc", + "verification_source": "https://bitcoin.org/bin/bitcoin-core-0.17.1/SHA256SUMS.asc", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/bitcoin-qt" diff --git a/configs/coins/bitcoin_testnet.json b/configs/coins/bitcoin_testnet.json index d51620b3..ea424cab 100644 --- a/configs/coins/bitcoin_testnet.json +++ b/configs/coins/bitcoin_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-bitcoin-testnet", "package_revision": "satoshilabs-1", "system_user": "bitcoin", - "version": "0.17.0", - "binary_url": "https://bitcoin.org/bin/bitcoin-core-0.17.0/bitcoin-0.17.0-x86_64-linux-gnu.tar.gz", + "version": "0.17.1", + "binary_url": "https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz", "verification_type": "gpg-sha256", - "verification_source": "https://bitcoin.org/bin/bitcoin-core-0.17.0/SHA256SUMS.asc", + "verification_source": "https://bitcoin.org/bin/bitcoin-core-0.17.1/SHA256SUMS.asc", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/bitcoin-qt"