diff --git a/client.go b/client.go index dcfe3b8..62e560a 100644 --- a/client.go +++ b/client.go @@ -40,6 +40,10 @@ func validateClientConfig(cfg *ClientConfig) { value := base.DefaultMaxArchiveSize cfg.MaxArchiveSize = &value } + if *(cfg.MaxArchiveSize) <= 0 { + value := base.DefaultMaxArchiveSize + cfg.MaxArchiveSize = &value + } if cfg.ArchivedExpirationInDays == nil { value := base.DefaultArchivedExpirationInDays cfg.ArchivedExpirationInDays = &value diff --git a/inspector.go b/inspector.go index 8222b8d..7bc4c00 100644 --- a/inspector.go +++ b/inspector.go @@ -35,6 +35,10 @@ func validateInspectorConfig(cfg *InspectorConfig) { value := base.DefaultMaxArchiveSize cfg.MaxArchiveSize = &value } + if *(cfg.MaxArchiveSize) <= 0 { + value := base.DefaultMaxArchiveSize + cfg.MaxArchiveSize = &value + } if cfg.ArchivedExpirationInDays == nil { value := base.DefaultArchivedExpirationInDays cfg.ArchivedExpirationInDays = &value diff --git a/internal/rdb/rdb.go b/internal/rdb/rdb.go index 5e48751..2a2850d 100644 --- a/internal/rdb/rdb.go +++ b/internal/rdb/rdb.go @@ -42,6 +42,10 @@ func validateRDBConfig(cfg *RDBConfig) { value := base.DefaultMaxArchiveSize cfg.MaxArchiveSize = &value } + if *(cfg.MaxArchiveSize) <= 0 { + value := base.DefaultMaxArchiveSize + cfg.MaxArchiveSize = &value + } if cfg.ArchivedExpirationInDays == nil { value := base.DefaultArchivedExpirationInDays cfg.ArchivedExpirationInDays = &value @@ -927,10 +931,6 @@ return redis.status_reply("OK")`) // Archive sends the given task to archive, attaching the error message to the task. // It also trims the archive by timestamp and set size. func (r *RDB) Archive(ctx context.Context, msg *base.TaskMessage, errMsg string) error { - if *(r.config.MaxArchiveSize) <= 0 { - return nil - } - var op errors.Op = "rdb.Archive" now := r.clock.Now() modified := *msg diff --git a/scheduler.go b/scheduler.go index 8c52cf2..005422b 100644 --- a/scheduler.go +++ b/scheduler.go @@ -157,7 +157,7 @@ type SchedulerOpts struct { // MaxArchiveSize specifies the maximum size of the archive that can be created by the server. // - // If unset the DefaultMaxArchiveSize is used. If set to a zero or a negative value, nothing will be archived. + // If unset or below 1, the DefaultMaxArchiveSize is used MaxArchiveSize *int // ArchivedExpirationInDays specifies the number of days after which archived tasks are deleted.