219 concurrent operations prohibited

This commit is contained in:
2026-03-24 17:52:31 +03:00
parent 16413a02ef
commit 2ce9a59252
3 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -57,7 +57,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="svc-api";
variables.framework.docs.APIVersion="0.218"; /*$ git config --global --unset user.password*/
variables.framework.docs.APIVersion="0.219"; /*$ git config --global --unset user.password*/
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
-3
View File
@@ -164,9 +164,6 @@
<m:field>iop.note</m:field>
<m:field>sop.config::text as config</m:field>
<m:field>null as nested_ref_data</m:field><!--- placeholder for future data --->
<m:field formatter=#request.castToBool#>sop.is_sensitive</m:field>
</m:field_set>
from svc_operation_cfs_param sop
+17 -4
View File
@@ -43,11 +43,17 @@
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
</cfquery>
<cfquery name="local.qInstance" result="local.result">
select io.instance_uid
from instance_operation io
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
</cfquery>
<!--- Check operation status, do not start already started (*** consider timeout and cancelling timed out operations here) --->
<cfquery name="local.qCheckStarted" result="local.result">
select io.dt_submit, io.dt_finish, io.dt_start, io.submit_result, io.status_url
from instance_operation io
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#arguments.instanceOperationUid#" null=#!isValid('guid',arguments.instanceOperationUid)#/>
where io.instance_operation_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#local.qInstance.instance_uid#" null=#!isValid('guid',local.qInstance.instance_uid)#/>
</cfquery> <!--- <cfdump var=#local.qCheckStarted.dt_finish#/><cfabort/> --->
<!---
@@ -57,10 +63,17 @@
Возможно, эту логику нужно воспроизвести на фронте
--->
<cfif local.qCheckStarted.recordCount EQ 0>
<cfreturn representationOf(this.helper.formatMessage("There is no configured instance operation with uid #arguments.instanceOperationUid#","Instance operation not found")).withStatus(404)/>
<cfreturn representationOf(this.helper.formatMessage(
"There is no configured instance operation with uid #arguments.instanceOperationUid#",
"Instance operation not found")
).withStatus(404)/>
<cfelseif left(local.qCheckStarted.submit_result,1) EQ "2" AND len(local.qCheckStarted.dt_finish) EQ 0><!--- 201 etc --->
<cfif getJobStatus(local.qCheckStarted.status_url) NEQ 'FAILED'>
<cfreturn representationOf(this.helper.formatMessage("Operation already started", "Parameter creation disabled for started operation")).withStatus(422)/>
<cfset var jobStatus = getJobStatus(local.qCheckStarted.status_url)/>
<cfif jobStatus NEQ 'FAILED'>
<cfreturn representationOf(this.helper.formatMessage(
"There is a started operation on this instance",
"Concurrent operations are not supported (job status: #jobStatus#)")
).withStatus(422)/>
</cfif>
</cfif>
<!--- Check CFS parameters at least for existence