mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-26 07:42: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
|
value := base.DefaultMaxArchiveSize
|
||||||
cfg.MaxArchiveSize = &value
|
cfg.MaxArchiveSize = &value
|
||||||
}
|
}
|
||||||
|
if *(cfg.MaxArchiveSize) <= 0 {
|
||||||
|
value := base.DefaultMaxArchiveSize
|
||||||
|
cfg.MaxArchiveSize = &value
|
||||||
|
}
|
||||||
if cfg.ArchivedExpirationInDays == nil {
|
if cfg.ArchivedExpirationInDays == nil {
|
||||||
value := base.DefaultArchivedExpirationInDays
|
value := base.DefaultArchivedExpirationInDays
|
||||||
cfg.ArchivedExpirationInDays = &value
|
cfg.ArchivedExpirationInDays = &value
|
||||||
|
@ -35,6 +35,10 @@ func validateInspectorConfig(cfg *InspectorConfig) {
|
|||||||
value := base.DefaultMaxArchiveSize
|
value := base.DefaultMaxArchiveSize
|
||||||
cfg.MaxArchiveSize = &value
|
cfg.MaxArchiveSize = &value
|
||||||
}
|
}
|
||||||
|
if *(cfg.MaxArchiveSize) <= 0 {
|
||||||
|
value := base.DefaultMaxArchiveSize
|
||||||
|
cfg.MaxArchiveSize = &value
|
||||||
|
}
|
||||||
if cfg.ArchivedExpirationInDays == nil {
|
if cfg.ArchivedExpirationInDays == nil {
|
||||||
value := base.DefaultArchivedExpirationInDays
|
value := base.DefaultArchivedExpirationInDays
|
||||||
cfg.ArchivedExpirationInDays = &value
|
cfg.ArchivedExpirationInDays = &value
|
||||||
|
@ -42,6 +42,10 @@ func validateRDBConfig(cfg *RDBConfig) {
|
|||||||
value := base.DefaultMaxArchiveSize
|
value := base.DefaultMaxArchiveSize
|
||||||
cfg.MaxArchiveSize = &value
|
cfg.MaxArchiveSize = &value
|
||||||
}
|
}
|
||||||
|
if *(cfg.MaxArchiveSize) <= 0 {
|
||||||
|
value := base.DefaultMaxArchiveSize
|
||||||
|
cfg.MaxArchiveSize = &value
|
||||||
|
}
|
||||||
if cfg.ArchivedExpirationInDays == nil {
|
if cfg.ArchivedExpirationInDays == nil {
|
||||||
value := base.DefaultArchivedExpirationInDays
|
value := base.DefaultArchivedExpirationInDays
|
||||||
cfg.ArchivedExpirationInDays = &value
|
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.
|
// Archive sends the given task to archive, attaching the error message to the task.
|
||||||
// It also trims the archive by timestamp and set size.
|
// It also trims the archive by timestamp and set size.
|
||||||
func (r *RDB) Archive(ctx context.Context, msg *base.TaskMessage, errMsg string) error {
|
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"
|
var op errors.Op = "rdb.Archive"
|
||||||
now := r.clock.Now()
|
now := r.clock.Now()
|
||||||
modified := *msg
|
modified := *msg
|
||||||
|
@ -157,7 +157,7 @@ type SchedulerOpts struct {
|
|||||||
|
|
||||||
// MaxArchiveSize specifies the maximum size of the archive that can be created by the server.
|
// 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
|
MaxArchiveSize *int
|
||||||
|
|
||||||
// ArchivedExpirationInDays specifies the number of days after which archived tasks are deleted.
|
// ArchivedExpirationInDays specifies the number of days after which archived tasks are deleted.
|
||||||
|
Loading…
Reference in New Issue
Block a user