(ctx context.Context, hook *Hook, success bool)
| 211 | } |
| 212 | |
| 213 | func (m *redisHookManager) updateHookStatus(ctx context.Context, hook *Hook, success bool) error { |
| 214 | hook.LastRun = time.Now() |
| 215 | hook.LastSuccess = success |
| 216 | |
| 217 | logrus.WithFields(logrus.Fields{ |
| 218 | "hook_id": hook.ID, |
| 219 | "hook_name": hook.Name, |
| 220 | "hook_type": hook.Type, |
| 221 | "success": success, |
| 222 | "last_run": hook.LastRun, |
| 223 | }).Info("Updated hook execution status") |
| 224 | |
| 225 | data, err := json.Marshal(hook) |
| 226 | if err != nil { |
| 227 | return fmt.Errorf("failed to marshal hook: %w", err) |
| 228 | } |
| 229 | |
| 230 | key := fmt.Sprintf("%s:%s", hookKeyPrefix, hook.ID) |
| 231 | return m.client.Set(ctx, key, data, 0).Err() |
| 232 | } |
no test coverage detected