From bbad4db645f716876435931ec5b90ff02e51b265 Mon Sep 17 00:00:00 2001 From: fanjiankong Date: Tue, 25 Aug 2020 23:41:15 +0800 Subject: [PATCH] Fix schedule error msg. Signed-off-by: fanjiankong --- src/controller/p2p/preheat/controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/controller/p2p/preheat/controller.go b/src/controller/p2p/preheat/controller.go index 2d648149e..b272e4bbf 100644 --- a/src/controller/p2p/preheat/controller.go +++ b/src/controller/p2p/preheat/controller.go @@ -377,7 +377,12 @@ func (c *controller) UpdatePolicy(ctx context.Context, schema *policyModels.Sche // Update timestamp schema.UpdatedTime = time.Now() - return c.pManager.Update(ctx, schema, props...) + err = c.pManager.Update(ctx, schema, props...) + if (err != nil) && (needSch || needUn) { + return errors.Wrapf(err, "Update failed, but not rollback scheduler") + } + + return err } // DeletePolicy deletes the policy by id.