mirror of
https://github.com/keven1024/015.git
synced 2026-05-31 01:19:35 +00:00
fix(models): handle JSON marshaling errors in SetRedis functions to improve error handling and data integrity
This commit is contained in:
@@ -29,7 +29,10 @@ func GetRedisTaskInfo(taskId string) (*map[string]any, error) {
|
||||
|
||||
func SetRedisTaskInfo(taskId string, taskInfo map[string]any) error {
|
||||
rdb, ctx := utils.GetRedisClient()
|
||||
jsonData, _ := json.Marshal(taskInfo)
|
||||
jsonData, err := json.Marshal(taskInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return rdb.Do(
|
||||
ctx,
|
||||
rdb.B().Set().Key(fmt.Sprintf("015:taskInfoMap:%s", taskId)).Value(string(jsonData)).Ex(time.Hour).Build(),
|
||||
|
||||
Reference in New Issue
Block a user