Reduce s3 sync interval when using replica URL

This commit changes the default sync interval from 10s to 1s
when replicating using the inline replica URL. This approach is
used when users are first testing the software so a faster
replication interval makes it easier to see results.
This commit is contained in:
Ben Johnson
2021-02-08 14:09:01 -07:00
parent 1b194535e6
commit 267b140fab

View File

@@ -11,6 +11,7 @@ import (
_ "net/http/pprof"
"os"
"os/signal"
"time"
"github.com/benbjohnson/litestream"
"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 {
dbConfig := &DBConfig{Path: fs.Arg(0)}
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}
} else if c.ConfigPath != "" {