add feature flag for experimental batcher
This commit is contained in:
parent
d60054c459
commit
20fa5b9a00
2 changed files with 15 additions and 1 deletions
|
@ -107,6 +107,9 @@ type (
|
|||
Driver string `envconfig:"DRONE_DATABASE_DRIVER" default:"sqlite3"`
|
||||
Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
|
||||
Secret string `envconfig:"DRONE_DATABASE_SECRET"`
|
||||
|
||||
// Feature flag
|
||||
ExperimentalBatch bool `envconfig:"DRONE_DATABASE_EXPERIMENTAL_BATCH"`
|
||||
}
|
||||
|
||||
// Docker provides docker configuration
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/drone/drone/core"
|
||||
"github.com/drone/drone/metric"
|
||||
"github.com/drone/drone/store/batch"
|
||||
"github.com/drone/drone/store/batch2"
|
||||
"github.com/drone/drone/store/build"
|
||||
"github.com/drone/drone/store/cron"
|
||||
"github.com/drone/drone/store/logs"
|
||||
|
@ -44,7 +45,8 @@ var storeSet = wire.NewSet(
|
|||
provideRepoStore,
|
||||
provideStageStore,
|
||||
provideUserStore,
|
||||
batch.New,
|
||||
provideBatchStore,
|
||||
// batch.New,
|
||||
cron.New,
|
||||
perm.New,
|
||||
secret.New,
|
||||
|
@ -129,3 +131,12 @@ func provideUserStore(db *db.DB) core.UserStore {
|
|||
metric.UserCount(users)
|
||||
return users
|
||||
}
|
||||
|
||||
// provideBatchStore is a Wire provider function that provides a
|
||||
// batcher. If the experimental batcher is enabled it is returned.
|
||||
func provideBatchStore(db *db.DB, config config.Config) core.BatchStore {
|
||||
if config.Database.ExperimentalBatch {
|
||||
return batch2.New(db)
|
||||
}
|
||||
return batch.New(db)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue