diff --git a/broker/cron_job.go b/broker/cron_job.go index 70d2da2..7f6771a 100644 --- a/broker/cron_job.go +++ b/broker/cron_job.go @@ -64,7 +64,7 @@ func CronJob(client redis.UniversalClient, broker Broker, message Message) ([]by } } - client.SAdd(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, *message.D.Name), taskId).Err() + client.SAdd(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, *message.D.Name), fmt.Sprintf("%s:%s", taskId, *message.D.Name)).Err() log.Infof("Added task with ID %s to run every %v.\n", taskId, timeVal) diff --git a/processor/cron_processor.go b/processor/cron_processor.go index 6950b81..ebefe60 100644 --- a/processor/cron_processor.go +++ b/processor/cron_processor.go @@ -26,7 +26,7 @@ func ProcessCronJob(client redis.UniversalClient, broker amqp091.Channel, name s c.Stop() client.Unlink(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_KEY_ROUTE, taskId)) client.Unlink(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_VALUE, name)) - client.SRem(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, name)).Err() + client.SRem(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, fmt.Sprintf("%s:%s", taskId, name))).Err() return } @@ -50,6 +50,6 @@ func ProcessCronJob(client redis.UniversalClient, broker amqp091.Channel, name s } else { client.Unlink(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_KEY_ROUTE, taskId)) client.Unlink(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_VALUE, name)) - client.SRem(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, name)).Err() + client.SRem(context.Background(), fmt.Sprintf("%s:%s", constants.TASK_REDIS_CRON_SETS, fmt.Sprintf("%s:%s", taskId, name))).Err() } } \ No newline at end of file