Revert "temporarily disable reflector and db"

This reverts commit fb2f807e6a.
This commit is contained in:
Alex Grintsvayg 2019-06-25 13:46:04 -04:00
parent fb2f807e6a
commit 46ae5a502a
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -3,12 +3,14 @@ package cmd
import (
"os"
"os/signal"
"strconv"
"syscall"
"time"
"github.com/lbryio/reflector.go/db"
"github.com/lbryio/reflector.go/meta"
"github.com/lbryio/reflector.go/peer"
"github.com/lbryio/reflector.go/reflector"
"github.com/lbryio/reflector.go/store"
log "github.com/sirupsen/logrus"
@ -33,22 +35,22 @@ func reflectorCmd(cmd *cobra.Command, args []string) {
}
s3 := store.NewS3BlobStore(globalConfig.AwsID, globalConfig.AwsSecret, globalConfig.BucketRegion, globalConfig.BucketName)
//combo := store.NewDBBackedS3Store(s3, db)
combo := store.NewDBBackedS3Store(s3, db)
//reflectorServer := reflector.NewServer(combo)
//reflectorServer.Timeout = 3 * time.Minute
//if globalConfig.SlackHookURL != "" {
// reflectorServer.StatLogger = log.StandardLogger()
// reflectorServer.StatReportFrequency = 1 * time.Hour
//}
//reflectorServer.EnableBlocklist = true
//
//err = reflectorServer.Start(":" + strconv.Itoa(reflector.DefaultPort))
//if err != nil {
// log.Fatal(err)
//}
reflectorServer := reflector.NewServer(combo)
reflectorServer.Timeout = 3 * time.Minute
if globalConfig.SlackHookURL != "" {
reflectorServer.StatLogger = log.StandardLogger()
reflectorServer.StatReportFrequency = 1 * time.Hour
}
reflectorServer.EnableBlocklist = true
peerServer := peer.NewServer(s3)
err = reflectorServer.Start(":" + strconv.Itoa(reflector.DefaultPort))
if err != nil {
log.Fatal(err)
}
peerServer := peer.NewServer(combo)
if globalConfig.SlackHookURL != "" {
peerServer.StatLogger = log.StandardLogger()
peerServer.StatReportFrequency = 1 * time.Hour
@ -62,5 +64,5 @@ func reflectorCmd(cmd *cobra.Command, args []string) {
signal.Notify(interruptChan, os.Interrupt, syscall.SIGTERM)
<-interruptChan
peerServer.Shutdown()
//reflectorServer.Shutdown()
reflectorServer.Shutdown()
}