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
branch: master
publish:
image: plugins/docker
repo: drone/drone
secrets: [ docker_username, docker_password ]
tag: [ latest, 0.6, 0.6.0, 0.6.0-rc.1 ]
trigger:
image: plugins/downstream
server: https://beta.drone.io
fork: true
secrets: [ downstream_token ]
repositories: drone/drone-enterprise
when:
branch: master
event: push

View file

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

View file

@ -3,6 +3,8 @@
package server
import (
"github.com/cncd/queue"
"github.com/drone/drone/model"
"github.com/drone/drone/store"
"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 setupStream(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) {
stmt := sql.Lookup(db.driver, "count-repos")
err = meddler.QueryAll(db, &count, stmt)
err = db.QueryRow(
sql.Lookup(db.driver, "count-repos"),
).Scan(&count)
return
}

View file

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