setup queue service in main package

This commit is contained in:
Brad Rydzewski 2017-05-04 02:02:08 +02:00
parent 72e3ad7886
commit 222bdd6854
5 changed files with 19 additions and 13 deletions

View file

@ -28,11 +28,12 @@ pipeline:
event: push event: push
branch: master branch: master
publish: trigger:
image: plugins/docker image: plugins/downstream
repo: drone/drone server: https://beta.drone.io
secrets: [ docker_username, docker_password ] fork: true
tag: [ latest, 0.6, 0.6.0, 0.6.0-rc.1 ] secrets: [ downstream_token ]
repositories: drone/drone-enterprise
when: when:
branch: master branch: master
event: push event: push

View file

@ -11,8 +11,6 @@ import (
"github.com/cncd/logging" "github.com/cncd/logging"
"github.com/cncd/pubsub" "github.com/cncd/pubsub"
"github.com/cncd/queue"
"github.com/drone/drone/model"
"github.com/drone/drone/plugins/registry" "github.com/drone/drone/plugins/registry"
"github.com/drone/drone/plugins/secrets" "github.com/drone/drone/plugins/secrets"
"github.com/drone/drone/plugins/sender" "github.com/drone/drone/plugins/sender"
@ -395,7 +393,7 @@ func setupEvilGlobals(c *cli.Context, v store.Store) {
droneserver.Config.Storage.Files = v droneserver.Config.Storage.Files = v
// services // services
droneserver.Config.Services.Queue = model.WithTaskStore(queue.New(), v) droneserver.Config.Services.Queue = setupQueue(c, v)
droneserver.Config.Services.Logs = logging.New() droneserver.Config.Services.Logs = logging.New()
droneserver.Config.Services.Pubsub = pubsub.New() droneserver.Config.Services.Pubsub = pubsub.New()
droneserver.Config.Services.Pubsub.Create(context.Background(), "topic/events") droneserver.Config.Services.Pubsub.Create(context.Background(), "topic/events")

View file

@ -3,6 +3,8 @@
package server package server
import ( import (
"github.com/cncd/queue"
"github.com/drone/drone/model"
"github.com/drone/drone/store" "github.com/drone/drone/store"
"github.com/drone/drone/store/datastore" "github.com/drone/drone/store/datastore"
@ -16,7 +18,10 @@ func setupStore(c *cli.Context) store.Store {
) )
} }
func setupQueue(c *cli.Context) {} func setupQueue(c *cli.Context, s store.Store) queue.Queue {
return model.WithTaskStore(queue.New(), s)
}
func setupPubsub(c *cli.Context) {} func setupPubsub(c *cli.Context) {}
func setupStream(c *cli.Command) {} func setupStream(c *cli.Command) {}
func setupRegistryService(c *cli.Command) {} func setupRegistryService(c *cli.Command) {}

View file

@ -40,8 +40,9 @@ func (db *datastore) GetRepoListOf(listof []*model.RepoLite) ([]*model.Repo, err
} }
func (db *datastore) GetRepoCount() (count int, err error) { func (db *datastore) GetRepoCount() (count int, err error) {
stmt := sql.Lookup(db.driver, "count-repos") err = db.QueryRow(
err = meddler.QueryAll(db, &count, stmt) sql.Lookup(db.driver, "count-repos"),
).Scan(&count)
return return
} }

View file

@ -67,8 +67,9 @@ func (db *datastore) GetUserFeedLatest(listof []*model.RepoLite) ([]*model.Feed,
} }
func (db *datastore) GetUserCount() (count int, err error) { func (db *datastore) GetUserCount() (count int, err error) {
stmt := sql.Lookup(db.driver, "count-users") err = db.QueryRow(
err = meddler.QueryAll(db, &count, stmt) sql.Lookup(db.driver, "count-users"),
).Scan(&count)
return return
} }