bazooka-ci / bazooka

Continuous Integration and Continuous Deployment Server
http://docs.bazooka-ci.io/
MIT License
60 stars 5 forks source link

In bzk run, Wait for mongo to start before starting server #171

Closed julienvey closed 9 years ago

julienvey commented 9 years ago

Sometimes, when running bzk run, when mongo takes some time to start, the server will try to start but fail because mongo is not yet reachable.

panic: no reachable servers

goroutine 1 [running]:
github.com/bazooka-ci/bazooka/commons/mongo.NewConnector(0x870110)
    /go/src/github.com/bazooka-ci/bazooka/commons/mongo/connector.go:47 +0x122
main.main()
    /go/src/github.com/bazooka-ci/bazooka/server/main.go:41 +0x4c6

goroutine 5 [sleep]:
gopkg.in/mgo%2ev2.(*mongoCluster).syncServersLoop(0xc20800c600)
    /go/src/gopkg.in/mgo.v2/cluster.go:383 +0x479
created by gopkg.in/mgo%2ev2.newCluster
    /go/src/gopkg.in/mgo.v2/cluster.go:76 +0x20b

goroutine 16 [sleep]:
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc208070000, 0x1)
    /go/src/gopkg.in/mgo.v2/server.go:297 +0x169
created by gopkg.in/mgo%2ev2.newServer
    /go/src/gopkg.in/mgo.v2/server.go:90 +0x196

goroutine 18 [sleep]:
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc2080700e0, 0x1)
    /go/src/gopkg.in/mgo.v2/server.go:297 +0x169
created by gopkg.in/mgo%2ev2.newServer
    /go/src/gopkg.in/mgo.v2/server.go:90 +0x196

Running bzk run again starts the server

We should wait a little between mongo and server to avoid this problem