diff --git a/checkjob.go b/checkjob.go index 51df214..8c477bb 100644 --- a/checkjob.go +++ b/checkjob.go @@ -67,7 +67,7 @@ func (c *CheckJob) Run(ctx context.Context) { go c.Walk(ctx) // 创建周期定时器 - ticker := time.NewTicker(time.Duration(c.Interval) * time.Minute) + ticker := time.NewTicker(time.Duration(c.Interval) * time.Hour) defer ticker.Stop() for range ticker.C { // 执行周期校对任务 diff --git a/storage.go b/storage.go index 8ed04ea..7ff9135 100644 --- a/storage.go +++ b/storage.go @@ -26,10 +26,13 @@ func NewStorage(c *config.SyncConfig) (*Storage, error) { Creds: credentials.NewStaticV4(c.Remote.SecretId, c.Remote.SecretKey, ""), Region: c.Remote.Region, Secure: c.Remote.UseSSL, + // 可以跳过证书校验,可用于自签发证书的场景 + //Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, }) if err != nil { return nil, err } + return &Storage{ Minio: cli, Bucket: c.Remote.Bucket, diff --git a/transfer.go b/transfer.go index 48b3874..b7f36d2 100644 --- a/transfer.go +++ b/transfer.go @@ -42,7 +42,7 @@ func (t *Transfer) Run(ctx context.Context) { err := filepath.WalkDir(path, func(subPath string, d fs.DirEntry, err error) error { if err := t.Storage.FPutObject(ctx, subPath); err != nil { log.Errorf("FPutObject err: %s, file: %s", err.Error(), subPath) - return filepath.SkipDir + return nil } log.Infof("Sync success, path: %s", subPath) return nil @@ -61,7 +61,7 @@ func (t *Transfer) Run(ctx context.Context) { if err := t.Storage.RemoveObjects(ctx, path); err != nil { continue } - log.Debugf("Remove success, path: %s", path) + log.Infof("Remove success, path: %s", path) } } diff --git a/watcher.go b/watcher.go index ee60513..0d4a0c9 100644 --- a/watcher.go +++ b/watcher.go @@ -67,7 +67,7 @@ func (w *Watcher) Watch() error { if !w.Enable { log.Debug("The real-time sync is disabled") - // Hold住进程,以便单用check job的场景 + // Hold进程,以便单用check job的场景 <-make(chan struct{}) }