More logging and use all processors unless otherwise noted.
This commit is contained in:
parent
abf6cd27ab
commit
a7eec08daa
4 changed files with 11 additions and 1 deletions
|
|
@ -20,8 +20,10 @@ import (
|
||||||
cayley_http "cayley_http"
|
cayley_http "cayley_http"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/barakmich/glog"
|
||||||
"graph"
|
"graph"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tripleFile = flag.String("triples", "", "Triple File to load before going to REPL.")
|
var tripleFile = flag.String("triples", "", "Triple File to load before going to REPL.")
|
||||||
|
|
@ -57,6 +59,12 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
var ts graph.TripleStore
|
var ts graph.TripleStore
|
||||||
config := cfg.ParseConfigFromFlagsAndFile(*configFile)
|
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 {
|
switch cmd {
|
||||||
case "init":
|
case "init":
|
||||||
cayley.CayleyInit(config, *tripleFile)
|
cayley.CayleyInit(config, *tripleFile)
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,14 @@ import (
|
||||||
"graph"
|
"graph"
|
||||||
|
|
||||||
cfg "cayley_config"
|
cfg "cayley_config"
|
||||||
|
"github.com/barakmich/glog"
|
||||||
"graph_leveldb"
|
"graph_leveldb"
|
||||||
"graph_memstore"
|
"graph_memstore"
|
||||||
"graph_mongo"
|
"graph_mongo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func OpenTSFromConfig(config *cfg.CayleyConfig) graph.TripleStore {
|
func OpenTSFromConfig(config *cfg.CayleyConfig) graph.TripleStore {
|
||||||
|
glog.Infof("Opening database \"%s\" at %s", config.DatabaseType, config.DatabasePath)
|
||||||
switch config.DatabaseType {
|
switch config.DatabaseType {
|
||||||
case "mongo", "mongodb":
|
case "mongo", "mongodb":
|
||||||
return graph_mongo.NewMongoTripleStore(config.DatabasePath, config.DatabaseOptions)
|
return graph_mongo.NewMongoTripleStore(config.DatabasePath, config.DatabaseOptions)
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ func SetupRoutes(ts graph.TripleStore, config *cfg.CayleyConfig) {
|
||||||
|
|
||||||
func CayleyHTTP(ts graph.TripleStore, config *cfg.CayleyConfig) {
|
func CayleyHTTP(ts graph.TripleStore, config *cfg.CayleyConfig) {
|
||||||
SetupRoutes(ts, config)
|
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)
|
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)
|
err := http.ListenAndServe(fmt.Sprintf("%s:%s", config.ListenHost, config.ListenPort), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ func (g *GremlinSession) SendResult(result *GremlinResult) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if g.doHalt {
|
if g.doHalt {
|
||||||
close(g.currentChannel)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if g.currentChannel != nil {
|
if g.currentChannel != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue