More logging and use all processors unless otherwise noted.

This commit is contained in:
Barak Michener 2014-06-21 13:55:41 -04:00
parent abf6cd27ab
commit a7eec08daa
4 changed files with 11 additions and 1 deletions

View file

@ -20,8 +20,10 @@ import (
cayley_http "cayley_http"
"flag"
"fmt"
"github.com/barakmich/glog"
"graph"
"os"
"runtime"
)
var tripleFile = flag.String("triples", "", "Triple File to load before going to REPL.")
@ -57,6 +59,12 @@ func main() {
flag.Parse()
var ts graph.TripleStore
config := cfg.ParseConfigFromFlagsAndFile(*configFile)
if os.Getenv("GOMAXPROCS") == "" {
runtime.GOMAXPROCS(runtime.NumCPU())
glog.Infoln("Setting GOMAXPROCS to", runtime.NumCPU())
} else {
glog.Infoln("GOMAXPROCS currently", os.Getenv("GOMAXPROCS"), " -- not adjusting")
}
switch cmd {
case "init":
cayley.CayleyInit(config, *tripleFile)

View file

@ -18,12 +18,14 @@ import (
"graph"
cfg "cayley_config"
"github.com/barakmich/glog"
"graph_leveldb"
"graph_memstore"
"graph_mongo"
)
func OpenTSFromConfig(config *cfg.CayleyConfig) graph.TripleStore {
glog.Infof("Opening database \"%s\" at %s", config.DatabaseType, config.DatabasePath)
switch config.DatabaseType {
case "mongo", "mongodb":
return graph_mongo.NewMongoTripleStore(config.DatabasePath, config.DatabaseOptions)

View file

@ -102,6 +102,7 @@ func SetupRoutes(ts graph.TripleStore, config *cfg.CayleyConfig) {
func CayleyHTTP(ts graph.TripleStore, config *cfg.CayleyConfig) {
SetupRoutes(ts, config)
glog.Infof("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort)
fmt.Printf("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort)
err := http.ListenAndServe(fmt.Sprintf("%s:%s", config.ListenHost, config.ListenPort), nil)
if err != nil {

View file

@ -89,7 +89,6 @@ func (g *GremlinSession) SendResult(result *GremlinResult) bool {
return false
}
if g.doHalt {
close(g.currentChannel)
return false
}
if g.currentChannel != nil {