diff --git a/const.go b/const.go index cb5a174..35ae37a 100644 --- a/const.go +++ b/const.go @@ -1,6 +1,6 @@ package gojobs const ( - Version = "1.0.81" + Version = "1.0.82" SpecifyIpNull = "0.0.0.0" ) diff --git a/lock_custom_id.go b/lock_custom_id.go index 11dc25a..b443bed 100644 --- a/lock_custom_id.go +++ b/lock_custom_id.go @@ -10,15 +10,15 @@ import ( // LockCustomId 上锁 func (c *Client) LockCustomId(ctx context.Context, info jobs_gorm_model.Task) (string, error) { - return c.cache.redisLockClient.Lock(ctx, fmt.Sprintf("%s%s%v%s%v%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.Id, info.CustomId), fmt.Sprintf("[LockCustomId] 已在%s@%s机器上锁成功,时间:%v", c.config.systemInsideIp, c.config.systemOutsideIp, gotime.Current().Format()), time.Duration(info.Frequency)*3*time.Second) + return c.cache.redisLockClient.Lock(ctx, fmt.Sprintf("%s%s%v%s%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.CustomId), fmt.Sprintf("[LockCustomId] 已在%s@%s机器上锁成功,时间:%v", c.config.systemInsideIp, c.config.systemOutsideIp, gotime.Current().Format()), time.Duration(info.Frequency)*3*time.Second) } // UnlockCustomId 解锁 func (c *Client) UnlockCustomId(ctx context.Context, info jobs_gorm_model.Task) error { - return c.cache.redisLockClient.Unlock(ctx, fmt.Sprintf("%s%s%v%s%v%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.Id, info.CustomId)) + return c.cache.redisLockClient.Unlock(ctx, fmt.Sprintf("%s%s%v%s%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.CustomId)) } // LockForeverCustomId 永远上锁 func (c *Client) LockForeverCustomId(ctx context.Context, info jobs_gorm_model.Task) (string, error) { - return c.cache.redisLockClient.LockForever(ctx, fmt.Sprintf("%s%s%v%s%v%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.Id, info.CustomId), fmt.Sprintf("[LockCustomId] 已在%s@%s机器永远上锁成功,时间:%v", c.config.systemInsideIp, c.config.systemOutsideIp, gotime.Current().Format())) + return c.cache.redisLockClient.LockForever(ctx, fmt.Sprintf("%s%s%v%s%v", c.cache.lockKeyPrefix, c.cache.lockKeySeparator, info.Type, c.cache.lockKeySeparator, info.CustomId), fmt.Sprintf("[LockCustomId] 已在%s@%s机器永远上锁成功,时间:%v", c.config.systemInsideIp, c.config.systemOutsideIp, gotime.Current().Format())) }