2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-24 23:02:18 +08:00

fix logic

This commit is contained in:
fajrifernanda 2024-12-04 14:34:11 +07:00
parent 3a771f1117
commit 8213e981a5

View File

@ -254,7 +254,7 @@ type Config struct {
// Make sure to not put a big number as the batch size to prevent a long-running script.
JanitorBatchSize int
// 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.
@ -440,6 +440,10 @@ func validateConfig(cfg *Config) {
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