mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-25 23:32:17 +08:00
fix logic
This commit is contained in:
parent
b689bb42e3
commit
3a771f1117
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user