increase wrtie timeout to allow long exports

This commit is contained in:
Umputun
2018-12-24 00:19:12 -06:00
parent 7484649621
commit b8ed722b2e
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ type BackupCommand struct {
ExportPath string `short:"p" long:"path" env:"BACKUP_PATH" default:"./var/backup" description:"export path"`
ExportFile string `short:"f" long:"file" default:"userbackup-{{.SITE}}-{{.TS}}.gz" description:"file name"`
Site string `short:"s" long:"site" env:"SITE" default:"remark" description:"site name"`
Timeout time.Duration `long:"timeout" default:"15m" description:"import timeout"`
Timeout time.Duration `long:"timeout" default:"15m" description:"export (backup) timeout"`
CommonOpts
}
+1 -1
View File
@@ -91,7 +91,7 @@ func (n *Native) Import(reader io.Reader, siteID string) (size int, err error) {
return 0, errors.Wrapf(err, "failed to import meta for site %s", siteID)
}
if m.Version != natvieVersion {
if m.Version != natvieVersion && m.Version != 0 { // this version allows back compatibility with 0 version
return 0, errors.Errorf("unexpected import file version %d", m.Version)
}
+1 -1
View File
@@ -147,7 +147,7 @@ func (s *Rest) makeHTTPServer(port int, router http.Handler) *http.Server {
Addr: fmt.Sprintf(":%d", port),
Handler: router,
ReadHeaderTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
WriteTimeout: 120 * time.Second, // TODO: such a long timeout needed for blocking export (backup) request
IdleTimeout: 30 * time.Second,
}
}