Skip to content

Commit

Permalink
config: add --sqlite-max-conns=[int] switch
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Apr 15, 2019
1 parent 1673539 commit cfcd169
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type config struct {
MempoolMaxInterval int `long:"mp-max-interval" description:"The maximum time in seconds between mempool reports (within a couple seconds), regarless of number of new tickets seen." env:"DCRDATA_MEMPOOL_MAX_INTERVAL"`
MPTriggerTickets int `long:"mp-ticket-trigger" description:"The number minimum number of new tickets that must be seen to trigger a new mempool report." env:"DCRDATA_MP_TRIGGER_TICKETS"`
DBFileName string `long:"dbfile" description:"SQLite DB file name (default is dcrdata.sqlt.db)." env:"DCRDATA_SQLITE_DB_FILE_NAME"`
SQLiteMaxConns int `long:"sqlite-max-conns" description:"The maximum number of open connections to the SQLite database. By default there is no limit."`
AgendasDBFileName string `long:"agendadbfile" description:"Agendas DB file name (default is agendas.db)." env:"DCRDATA_AGENDAS_DB_FILE_NAME"`
ProposalsFileName string `long:"proposalsdbfile" description:"Proposals DB file name (default is proposals.db)." env:"DCRDATA_PROPOSALS_DB_FILE_NAME"`
PoliteiaAPIURL string `long:"politeiaurl" description:"Defines the root API politeia URL (defaults to https://proposals.decred.org)."`
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ func _main(ctx context.Context) error {
log.Infof("SQLite DB successfully opened: %s", cfg.DBFileName)
defer baseDB.Close()

baseDB.DB.SetMaxOpenConns(cfg.SQLiteMaxConns)

if err = baseDB.ReportHeights(); err != nil {
return fmt.Errorf("Possible SQLite corruption: %v", err)
}
Expand Down

0 comments on commit cfcd169

Please sign in to comment.