mirror of
https://github.com/harness/drone.git
synced 2025-05-11 14:40:05 +08:00
add feature flag for experimental batcher
This commit is contained in:
parent
d60054c459
commit
20fa5b9a00
@ -107,6 +107,9 @@ type (
|
|||||||
Driver string `envconfig:"DRONE_DATABASE_DRIVER" default:"sqlite3"`
|
Driver string `envconfig:"DRONE_DATABASE_DRIVER" default:"sqlite3"`
|
||||||
Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
|
Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
|
||||||
Secret string `envconfig:"DRONE_DATABASE_SECRET"`
|
Secret string `envconfig:"DRONE_DATABASE_SECRET"`
|
||||||
|
|
||||||
|
// Feature flag
|
||||||
|
ExperimentalBatch bool `envconfig:"DRONE_DATABASE_EXPERIMENTAL_BATCH"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Docker provides docker configuration
|
// Docker provides docker configuration
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/metric"
|
"github.com/drone/drone/metric"
|
||||||
"github.com/drone/drone/store/batch"
|
"github.com/drone/drone/store/batch"
|
||||||
|
"github.com/drone/drone/store/batch2"
|
||||||
"github.com/drone/drone/store/build"
|
"github.com/drone/drone/store/build"
|
||||||
"github.com/drone/drone/store/cron"
|
"github.com/drone/drone/store/cron"
|
||||||
"github.com/drone/drone/store/logs"
|
"github.com/drone/drone/store/logs"
|
||||||
@ -44,7 +45,8 @@ var storeSet = wire.NewSet(
|
|||||||
provideRepoStore,
|
provideRepoStore,
|
||||||
provideStageStore,
|
provideStageStore,
|
||||||
provideUserStore,
|
provideUserStore,
|
||||||
batch.New,
|
provideBatchStore,
|
||||||
|
// batch.New,
|
||||||
cron.New,
|
cron.New,
|
||||||
perm.New,
|
perm.New,
|
||||||
secret.New,
|
secret.New,
|
||||||
@ -129,3 +131,12 @@ func provideUserStore(db *db.DB) core.UserStore {
|
|||||||
metric.UserCount(users)
|
metric.UserCount(users)
|
||||||
return 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 New Issue
Block a user