From 1e3cdccc6438d58ad23f8b7aa480ad0c9ef1ae06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guih=C3=A9neuf?= Date: Wed, 21 Jan 2026 18:08:23 +0100 Subject: [PATCH] Remove payload update logic Always sending full payload now --- apihandlers/post_feed_instance_action.go | 28 +++++++++-------- apihandlers/put_feed_instance_action.go | 40 ++++++++---------------- 2 files changed, 28 insertions(+), 40 deletions(-) diff --git a/apihandlers/post_feed_instance_action.go b/apihandlers/post_feed_instance_action.go index c427ecb..91e66a5 100644 --- a/apihandlers/post_feed_instance_action.go +++ b/apihandlers/post_feed_instance_action.go @@ -13,19 +13,21 @@ import ( "github.com/opensvc/oc3/cachekeys" ) -// { -// "action": "thaw", -// "argv": [ -// "foo", -// "thaw", -// "--local" -// ], -// "begin": "2026-01-12 10:57:12", -// "cron": false, -// "path": "foo", -// "session_uuid": "b9d795bc-498e-4c20-aada-9feec2eaa947", -// "version": "2.1-1977" -// } +/* +{ + "action": "thaw", + "argv": [ + "foo", + "thaw", + "--local" + ], + "begin": "2026-01-21T18:00:00.357669+01:00", + "cron": false, + "path": "foo", + "session_uuid": "b9d795bc-498e-4c20-aada-9feec2eaa947", + "version": "2.1-1977" +} +*/ // PostFeedInstanceAction handles POST /action/begin func (a *Api) PostFeedInstanceAction(c echo.Context) error { diff --git a/apihandlers/put_feed_instance_action.go b/apihandlers/put_feed_instance_action.go index 1c30e82..c05cd31 100644 --- a/apihandlers/put_feed_instance_action.go +++ b/apihandlers/put_feed_instance_action.go @@ -11,17 +11,19 @@ import ( "github.com/opensvc/oc3/cachekeys" ) -// { -// "uuid": "ea9a8373-3dda-4fe7-8c4b-08f5290c6c8b", -// "path": "foo", -// "action": "thaw", -// "begin": "2026-01-16 15:05:00", -// "end": "2026-01-16 15:06:00", -// "cron": false, -// "session_uuid": "7f2df7b2-8a4a-4bc1-9a8b-03acffaacd45", -// "actionlogfile": "/var/tmp/opensvc/foo.freezeupdfl98l", -// "status": "ok" -// } +/* +{ + "uuid": "ea9a8373-3dda-4fe7-8c4b-08f5290c6c8b", + "path": "foo", + "action": "thaw", + "begin": "2026-01-21T18:00:00.357669+01:00", + "end": "2026-01-21T18:05:00.357669+01:00", + "cron": false, + "session_uuid": "7f2df7b2-8a4a-4bc1-9a8b-03acffaacd45", + "actionlogfile": "/var/tmp/opensvc/foo.freezeupdfl98l", + "status": "ok" +} +*/ // PutFeedInstanceActionEnd handles PUT /feed/action func (a *Api) PutFeedInstanceActionEnd(c echo.Context) error { @@ -56,22 +58,6 @@ func (a *Api) PutFeedInstanceActionEnd(c echo.Context) error { idx := fmt.Sprintf("%s@%s@%s:%s", payload.Path, nodeID, ClusterID, payload.Uuid) - // if action is pending, update the stored begin action with end info to avoid begin and end processing - if n, err := a.Redis.HExists(reqCtx, keyPendingH, idx).Result(); err == nil && n { - if currentBytes, err := a.Redis.HGet(reqCtx, keyH, idx).Bytes(); err == nil { - var currentAction api.Action - if err := json.Unmarshal(currentBytes, ¤tAction); err == nil { - currentAction.End = payload.End - currentAction.Status = payload.Status - currentAction.StatusLog = payload.StatusLog - - if updatedBytes, err := json.Marshal(currentAction); err == nil { - b = updatedBytes - } - } - } - } - s := fmt.Sprintf("HSET %s %s", keyH, idx) if _, err := a.Redis.HSet(reqCtx, keyH, idx, b).Result(); err != nil { s = fmt.Sprintf("%s: %s", s, err)