modified ProcessProcedureQueue to mark requests as queued and only re-queue them if they have been queued for over ten minutes
This commit is contained in:
@ -55,7 +55,7 @@ Service CreateLotEvent(LotId, EventDateTime, EventType=EVENT_TYPES, EventNote, E
|
|||||||
NewEventRec<LOT_EVENT_SEQUENCE$> = NewEventSequence
|
NewEventRec<LOT_EVENT_SEQUENCE$> = NewEventSequence
|
||||||
Database_Services('WriteDataRow', 'LOT_EVENT', NewEventId, NewEventRec)
|
Database_Services('WriteDataRow', 'LOT_EVENT', NewEventId, NewEventRec)
|
||||||
If Error_Services('NoError') then
|
If Error_Services('NoError') then
|
||||||
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', 'SetLatestLotEvent':@VM:LotId:@VM:NewEventId, True$)
|
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', 'SetLatestLotEvent':@VM:LotId:@VM:NewEventId)
|
||||||
end else
|
end else
|
||||||
ErrorMessage = 'Error creating new event : ' : Error_Services('GetMessage')
|
ErrorMessage = 'Error creating new event : ' : Error_Services('GetMessage')
|
||||||
end
|
end
|
||||||
@ -169,4 +169,3 @@ InitEventLog:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Common /ServiceServices/ Unused1@, Unused2@, Unused3@, Unused4@, Unused5@, Unuse
|
|||||||
|
|
||||||
Declare function Service_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services, Datetime
|
Declare function Service_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services, Datetime
|
||||||
Declare function GetTickCount, SRP_Decode, RTI_CreateGuid, UCase, Environment_services, Logging_Services,
|
Declare function GetTickCount, SRP_Decode, RTI_CreateGuid, UCase, Environment_services, Logging_Services,
|
||||||
Declare function SRP_TCPClient
|
Declare function SRP_TCPClient, SRP_Datetime
|
||||||
Declare subroutine Service_Services, Memory_Services, SRP_List, SRP_FastArray, RList, Set_Status, Database_Services
|
Declare subroutine Service_Services, Memory_Services, SRP_List, SRP_FastArray, RList, Set_Status, Database_Services
|
||||||
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract, Logging_Services, obj_Notes, SRP_TCPClient
|
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract, Logging_Services, obj_Notes, SRP_TCPClient
|
||||||
|
|
||||||
@ -171,18 +171,35 @@ Service ProcessProcedureQueue()
|
|||||||
Lock hSysLists, ServiceKeyID then
|
Lock hSysLists, ServiceKeyID then
|
||||||
ServerIP = Environment_Services('GetApplicationRootIP')
|
ServerIP = Environment_Services('GetApplicationRootIP')
|
||||||
ServerPort = Environment_Services('GetServiceManagerPort')
|
ServerPort = Environment_Services('GetServiceManagerPort')
|
||||||
Convert '\' to '' in ServerIP
|
Convert '\' to '' in ServerIP
|
||||||
Open 'PROC_QUEUE' to hProcQueue then
|
|
||||||
|
Open 'PROC_QUEUE2' to hProcQueue then
|
||||||
Select hProcQueue
|
Select hProcQueue
|
||||||
EOF = False$
|
EOF = False$
|
||||||
Loop
|
Loop
|
||||||
ReadNext RequestKeyID else EOF = True$
|
ReadNext RequestKeyID else EOF = True$
|
||||||
Until EOF
|
Until EOF
|
||||||
TcpClientHandle = 0
|
SendRequest = True$
|
||||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', ServerIP, ServerPort) then
|
Read RequestRec from hProcQueue, RequestKeyID then
|
||||||
Command = 'RUN SERVICE_SERVICES "ProcessRequest", ':Quote(RequestKeyID)
|
InQueue = RequestRec<PROC_QUEUE.IN_QUEUE$>
|
||||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
If InQueue then
|
||||||
SRP_TcpClient(TcpClientHandle, 'CLOSE_SES')
|
QueuedDtm = RequestRec<PROC_QUEUE.QUEUED_DTM$>
|
||||||
|
If QueuedDtm GT SRP_Datetime('AddMinutes', Datetime(), -10) then
|
||||||
|
SendRequest = False$
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
If SendRequest then
|
||||||
|
TcpClientHandle = 0
|
||||||
|
If SRP_TcpClient(TcpClientHandle, 'CONNECT', ServerIP, ServerPort) then
|
||||||
|
RequestRec<PROC_QUEUE.IN_QUEUE$> = True$
|
||||||
|
RequestRec<PROC_QUEUE.QUEUED_DTM$> = Datetime()
|
||||||
|
Write RequestRec on hProcQueue, RequestKeyID then
|
||||||
|
Command = 'RUN SERVICE_SERVICES "ProcessRequest", ':Quote(RequestKeyID)
|
||||||
|
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
||||||
|
end
|
||||||
|
SRP_TcpClient(TcpClientHandle, 'CLOSE_SES')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Repeat
|
Repeat
|
||||||
end
|
end
|
||||||
@ -198,8 +215,8 @@ Service ProcessRequest(RequestKeyID)
|
|||||||
DeleteRequest = True$
|
DeleteRequest = True$
|
||||||
Server = Environment_Services('GetServer')
|
Server = Environment_Services('GetServer')
|
||||||
Done = True$
|
Done = True$
|
||||||
If RowExists('PROC_QUEUE', RequestKeyID) then
|
If RowExists('PROC_QUEUE2', RequestKeyID) then
|
||||||
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
|
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE2', RequestKeyID)
|
||||||
If RequestRow NE '' then
|
If RequestRow NE '' then
|
||||||
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
|
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
|
||||||
Procedure = UCase(Procedure)
|
Procedure = UCase(Procedure)
|
||||||
@ -244,7 +261,7 @@ Service ProcessRequest(RequestKeyID)
|
|||||||
RequestRow<PROC_QUEUE.NUM_ATTEMPTS$> = NumAttempts
|
RequestRow<PROC_QUEUE.NUM_ATTEMPTS$> = NumAttempts
|
||||||
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = Datetime()
|
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = Datetime()
|
||||||
RequestRow<PROC_QUEUE.ERROR$> = 'Error_Services error message: ':ErrorMessage:' Get_Status error code: ':ErrCode
|
RequestRow<PROC_QUEUE.ERROR$> = 'Error_Services error message: ':ErrorMessage:' Get_Status error code: ':ErrCode
|
||||||
Database_Services('WriteDataRow', 'PROC_QUEUE', RequestKeyId, RequestRow, True$, False$, False$)
|
Database_Services('WriteDataRow', 'PROC_QUEUE2', RequestKeyId, RequestRow, True$, False$, False$)
|
||||||
end else
|
end else
|
||||||
// Notify OI_SYSADMIN group
|
// Notify OI_SYSADMIN group
|
||||||
Recipients = ''
|
Recipients = ''
|
||||||
@ -302,7 +319,7 @@ Service ProcessRequest(RequestKeyID)
|
|||||||
obj_Notes('Create',Parms)
|
obj_Notes('Create',Parms)
|
||||||
end
|
end
|
||||||
If DeleteRequest then
|
If DeleteRequest then
|
||||||
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$)
|
Database_Services('DeleteDataRow', 'PROC_QUEUE2', RequestKeyId, True$, False$)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -315,32 +332,13 @@ Service PostProcedure(ProcedureName, Params, Critical=BOOLEAN)
|
|||||||
If Critical EQ '' then Critical = True$
|
If Critical EQ '' then Critical = True$
|
||||||
PostToQueue = True$
|
PostToQueue = True$
|
||||||
If (ProcedureName NE '') then
|
If (ProcedureName NE '') then
|
||||||
If Not(Critical) then
|
RequestKeyID = RTI_CreateGUID()
|
||||||
// Check if there is already a matching request in the queue before posting another one.
|
RequestRow = ''
|
||||||
Query = 'PROC_NAME':@VM:ProcedureName:@FM
|
RequestRow<PROC_QUEUE.PROC_NAME$> = ProcedureName
|
||||||
Query := 'PARAMS':@VM:Params:@FM
|
RequestRow<PROC_QUEUE.PARAMS$> = Params
|
||||||
Open 'DICT.PROC_QUEUE' to hDict then
|
RequestRow<PROC_QUEUE.ENTRY_DTM$> = Datetime()
|
||||||
Keys = ''
|
RequestRow<PROC_QUEUE.IN_QUEUE$> = False$
|
||||||
Option = 'E'
|
Database_Services('WriteDataRow', 'PROC_QUEUE2', RequestKeyID, RequestRow, True$, False$, False$)
|
||||||
Flag = ''
|
|
||||||
Btree.Extract(Query, 'PROC_QUEUE', hDict, Keys, Option, Flag)
|
|
||||||
If Flag EQ 0 then
|
|
||||||
If Keys NE '' then PostToQueue = False$
|
|
||||||
end else
|
|
||||||
Error_Services('Add', 'Error in ':Service:' service. Error calling Btree.Extract.')
|
|
||||||
end
|
|
||||||
end else
|
|
||||||
Error_Services('Add', 'Error in ':Service:' service. Error opening DICT.PROC_QUEUE.')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
If PostToQueue then
|
|
||||||
RequestKeyID = RTI_CreateGUID()
|
|
||||||
RequestRow = ''
|
|
||||||
RequestRow<PROC_QUEUE.PROC_NAME$> = ProcedureName
|
|
||||||
RequestRow<PROC_QUEUE.PARAMS$> = Params
|
|
||||||
RequestRow<PROC_QUEUE.ENTRY_DTM$> = Datetime()
|
|
||||||
Database_Services('WriteDataRow', 'PROC_QUEUE', RequestKeyID, RequestRow, True$, False$, False$)
|
|
||||||
end
|
|
||||||
end else
|
end else
|
||||||
Error_Services('Add', 'Error in ':Service:' service. Null ProcedureName passed in.')
|
Error_Services('Add', 'Error in ':Service:' service. Null ProcedureName passed in.')
|
||||||
end
|
end
|
||||||
|
19
LSL2/STPROCINS/PROC_QUEUE2_EQUATES.txt
Normal file
19
LSL2/STPROCINS/PROC_QUEUE2_EQUATES.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
compile insert PROC_QUEUE2_EQUATES
|
||||||
|
/*----------------------------------------
|
||||||
|
Author : Table Create Insert Routine
|
||||||
|
Written : 25/06/2025
|
||||||
|
Description : Insert for Table PROC_QUEUE2
|
||||||
|
----------------------------------------*/
|
||||||
|
#ifndef __PROC_QUEUE2_EQUATES__
|
||||||
|
#define __PROC_QUEUE2_EQUATES__
|
||||||
|
|
||||||
|
equ PROC_QUEUE2.PROC_NAME$ to 1
|
||||||
|
equ PROC_QUEUE2.PARAMS$ to 2
|
||||||
|
equ PROC_QUEUE2.LAST_ATTEMPT_DTM$ to 3
|
||||||
|
equ PROC_QUEUE2.ERROR$ to 4
|
||||||
|
equ PROC_QUEUE2.ENTRY_DTM$ to 5
|
||||||
|
equ PROC_QUEUE2.NUM_ATTEMPTS$ to 6
|
||||||
|
equ PROC_QUEUE2.IN_QUEUE$ to 7
|
||||||
|
equ PROC_QUEUE2.QUEUED_DTM$ to 8
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,7 @@
|
|||||||
compile insert PROC_QUEUE_EQUATES
|
compile insert PROC_QUEUE_EQUATES
|
||||||
/*----------------------------------------
|
/*----------------------------------------
|
||||||
Author : Table Create Insert Routine
|
Author : Table Create Insert Routine
|
||||||
Written : 09/12/2024
|
Written : 25/06/2025
|
||||||
Description : Insert for Table PROC_QUEUE
|
Description : Insert for Table PROC_QUEUE
|
||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
#ifndef __PROC_QUEUE_EQUATES__
|
#ifndef __PROC_QUEUE_EQUATES__
|
||||||
@ -12,8 +12,8 @@ compile insert PROC_QUEUE_EQUATES
|
|||||||
equ PROC_QUEUE.LAST_ATTEMPT_DTM$ to 3
|
equ PROC_QUEUE.LAST_ATTEMPT_DTM$ to 3
|
||||||
equ PROC_QUEUE.ERROR$ to 4
|
equ PROC_QUEUE.ERROR$ to 4
|
||||||
equ PROC_QUEUE.ENTRY_DTM$ to 5
|
equ PROC_QUEUE.ENTRY_DTM$ to 5
|
||||||
equ PROC_QUEUE.NUM_ATTEMPTS$ to 6
|
equ PROC_QUEUE.NUM_ATTEMPTS$ to 6
|
||||||
|
equ PROC_QUEUE.IN_QUEUE$ to 7
|
||||||
|
equ PROC_QUEUE.QUEUED_DTM$ to 8
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
compile insert PROC_QUEUE_FAILED_EQUATES
|
compile insert PROC_QUEUE_FAILED_EQUATES
|
||||||
/*----------------------------------------
|
/*----------------------------------------
|
||||||
Author : Table Create Insert Routine
|
Author : Table Create Insert Routine
|
||||||
Written : 06/06/2025
|
Written : 25/06/2025
|
||||||
Description : Insert for Table PROC_QUEUE_FAILED
|
Description : Insert for Table PROC_QUEUE_FAILED
|
||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
#ifndef __PROC_QUEUE_FAILED_EQUATES__
|
#ifndef __PROC_QUEUE_FAILED_EQUATES__
|
||||||
#define __PROC_QUEUE_FAILED_EQUATES__
|
#define __PROC_QUEUE_FAILED_EQUATES__
|
||||||
|
|
||||||
equ PROC_QUEUE_FAILED.PROC_NAME$ to 1
|
equ PROC_QUEUE_FAILED.PROC_NAME$ to 1
|
||||||
equ PROC_QUEUE_FAILED.PARAMS$ to 2
|
equ PROC_QUEUE_FAILED.PARAMS$ to 2
|
||||||
equ PROC_QUEUE_FAILED.COMP_DTM$ to 3
|
equ PROC_QUEUE_FAILED.LAST_ATTEMPT_DTM$ to 3
|
||||||
equ PROC_QUEUE_FAILED.ERROR$ to 4
|
equ PROC_QUEUE_FAILED.ERROR$ to 4
|
||||||
equ PROC_QUEUE_FAILED.ENTRY_DTM$ to 5
|
equ PROC_QUEUE_FAILED.ENTRY_DTM$ to 5
|
||||||
equ PROC_QUEUE_FAILED.NUM_ATTEMPTS$ to 6
|
equ PROC_QUEUE_FAILED.NUM_ATTEMPTS$ to 6
|
||||||
|
equ PROC_QUEUE_FAILED.IN_QUEUE$ to 7
|
||||||
|
equ PROC_QUEUE_FAILED.QUEUED_DTM$ to 8
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user