cache the TW type list

This commit is contained in:
Chase Tucker
2025-07-09 10:58:58 -07:00
committed by Tucker Chase (CSC FI SPS MESLEO)
parent 5830705c7d
commit 184d2c2cba

View File

@ -1711,7 +1711,6 @@ Service ConvertMVScanToJSON(ScanID, mvScan, itemURL)
SRP_JSON(objScan, 'SetValue', 'ID', @ID, 'String')
SRP_JSON(objScan, 'SetValue', 'type', {SCAN_TYPE}, 'String')
SRP_JSON(objScan, 'SetValue', 'action', {ACTION}, 'String')
SRP_JSON(objScan, 'SetValue', 'testRunTypeId', {TEST_RUN_TYPE_ID}, 'Integer')
SRP_JSON(objScan, 'SetValue', 'acceptable', {ACCEPTABLE}, 'Boolean')
SRP_JSON(objScan, 'SetValue', 'notAcceptableReason', {NOT_ACCEPTABLE_REASON}, 'String')
@ -1768,9 +1767,32 @@ Service ConvertMVScanToJSON(ScanID, mvScan, itemURL)
SRP_JSON(hTWLotArray, 'Release')
end
SRP_JSON(objScan, 'SetValue', 'testRunTypeId', {TEST_RUN_TYPE_ID}, 'Integer')
// TestRun Type Option Array
TestRunTypeList = Test_Run_Services('GetAllTestRunTypes')
twRunTypeListCacheKey$ = 'TW_RUN_TYPE_OPTIONS'
jsonField$ = 1
lastTickField$ = 2
oneHourTicks$ = 3600000
TestRunTypeOptionsJson = Xlate('APP_INFO', twRunTypeListCacheKey$, jsonField$, 'X')
LastTick = Xlate('APP_INFO', 'TW_RUN_TYPE_OPTIONS', lastTickField$, 'X')
TickDiff = oneHourTicks$ + oneHourTicks$
ParsingResponse = ''
If TestRunTypeOptionsJson NE '' and LastTick NE '' and Num(LastTick) then
TickDiff = GetTickCount() - LastTick
If TestRunTypeOptionsJson NE '' and TickDiff LT oneHourTicks$ then
ParsingResponse = SRP_JSON(hTRTypeOpts, 'Parse', TestRunTypeOptionsJson)
If ParsingResponse EQ '' then
SRP_JSON(objJSONScan, 'Set', 'testRunTypeOptions', hTRTypeOpts)
end
end
end
If LastTick EQ '' or Num(LastTick) EQ False$ or TestRunTypeOptionsJson EQ '' or TickDiff GE oneHourTicks$ or ParsingResponse NE '' then
If SRP_JSON(hTestRunTypeArray, 'New', 'Array') then
TestRunTypeList = Test_Run_Services('GetAllTestRunTypes')
For each TestRunTypeId in TestRunTypeList<1> using @VM setting fPos
hTestRunTypeObj = ''
If SRP_JSON(hTestRunTypeObj, 'New', 'Object') then
@ -1785,6 +1807,15 @@ Service ConvertMVScanToJSON(ScanID, mvScan, itemURL)
Next TestRunTypeId
If Abort EQ False$ then
SRP_JSON(objJSONScan, 'Set', 'testRunTypeOptions', hTestRunTypeArray)
TRTypeListJson = SRP_JSON(hTestRunTypeArray, 'Stringify', 'Fast')
LastTick = GetTickCount()
twRunTypeOptionsRec = ''
twRunTypeOptionsRec<jsonField$> = TRTypeListJson
twRunTypeOptionsRec<lastTickField$> = LastTick
Database_Services('WriteDataRow', 'APP_INFO', twRunTypeListCacheKey$, twRunTypeOptionsRec, True$, False$, False$)
end
end
SRP_JSON(hTestRunTypeArray, 'Release')
end
@ -2350,3 +2381,5 @@ return