~comcloudway/builds.sr.ht

4b4c5086b6cd195f758d3064ef8ac41affbbd696 — Luca Weiss 5 years ago a17b30c
worker: test db connection before starting worker

Without this, a misconfigured database string would not be noticed
(immediately), but now the worker aborts directly if it can't access the
database.
1 files changed, 3 insertions(+), 0 deletions(-)

M worker/main.go
M worker/main.go => worker/main.go +3 -0
@@ 47,6 47,9 @@ func main() {
	if err != nil {
		panic(err)
	}
	if err := db.Ping(); err != nil {
		log.Fatalf("Failed to open a database connection: %v", err)
	}

	clusterRedis := conf("builds.sr.ht", "redis")
	broker := celery.NewRedisCeleryBroker(clusterRedis)