jiangpengcheng commented on a change in pull request #4986: URL: https://github.com/apache/openwhisk/pull/4986#discussion_r511686267
########## File path: core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala ########## @@ -218,9 +229,36 @@ trait WhiskActionsApi extends WhiskCollectionAPI with PostActionActivation with onComplete(checkAdditionalPrivileges) { case Success(_) => - putEntity(WhiskAction, entityStore, entityName.toDocId, overwrite, update(user, request) _, () => { - make(user, entityName, request) - }) + onComplete(WhiskActionVersionList.get(entityName, entityStore)) { + case Success(result) => + val id = result.matchedDocId(content.version).getOrElse(entityName.toDocId) + putEntity( + WhiskAction, + entityStore, + id, + true, + update(user, request) _, + () => { + make(user, entityName, request) + }, + postProcess = Some { action: WhiskAction => + // delete oldest version when created successfully Review comment: good idea, I will update ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org