Merge pull request #39 from benbjohnson/replicate-s3-sync-interval

Reduce s3 sync interval when using replica URL
This commit is contained in:
Ben Johnson
2021-02-08 14:14:20 -07:00
committed by GitHub

View File

@@ -11,6 +11,7 @@ import (
_ "net/http/pprof" _ "net/http/pprof"
"os" "os"
"os/signal" "os/signal"
"time"
"github.com/benbjohnson/litestream" "github.com/benbjohnson/litestream"
"github.com/benbjohnson/litestream/s3" "github.com/benbjohnson/litestream/s3"
@@ -43,7 +44,10 @@ func (c *ReplicateCommand) Run(ctx context.Context, args []string) (err error) {
} else if fs.NArg() > 1 { } else if fs.NArg() > 1 {
dbConfig := &DBConfig{Path: fs.Arg(0)} dbConfig := &DBConfig{Path: fs.Arg(0)}
for _, u := range fs.Args()[1:] { for _, u := range fs.Args()[1:] {
dbConfig.Replicas = append(dbConfig.Replicas, &ReplicaConfig{URL: u}) dbConfig.Replicas = append(dbConfig.Replicas, &ReplicaConfig{
URL: u,
SyncInterval: 1 * time.Second,
})
} }
config.DBs = []*DBConfig{dbConfig} config.DBs = []*DBConfig{dbConfig}
} else if c.ConfigPath != "" { } else if c.ConfigPath != "" {