DataWindow :
- correzioni connesione Redis locale.
This commit is contained in:
@@ -27,8 +27,7 @@ local XML = require( 'xml2lua')
|
||||
_G.package.loaded.XMLHandler = nil
|
||||
local XMLHandler = require( 'xml2lua_tree')
|
||||
|
||||
local nRedisConnectionId = 0
|
||||
|
||||
local s_nRedisConnectionId = 0 -- 0 connessione non definita, > 0 connessione definita
|
||||
local s_dDowelTol = 1
|
||||
local s_dSimplSolidApprox = 0.2 -- approssimazione lineare nel caso di solidi semplificati
|
||||
local s_nSashNbr = 0 -- contatore delle ante per assegnare nomi
|
||||
@@ -5587,12 +5586,12 @@ local function AddHardwareForSash( nFrameId, nReturnMode, OutputKitList, OutputP
|
||||
|
||||
local JsonQuestion = JSON:encode( Question)
|
||||
|
||||
local bOk = EgtRedisAsyncPublish( nRedisConnectionId, QuestionChannel, JsonQuestion)
|
||||
local bOk = EgtRedisAsyncPublish( s_nRedisConnectionId, QuestionChannel, JsonQuestion)
|
||||
local AnswerArgs
|
||||
if bOk then
|
||||
-- EgtOutLog( 'Messaggio Redis pubblicato:' .. QuestionChannel .. ' ' .. JsonQuestion)
|
||||
EgtOutLog( 'Messaggio Redis pubblicato')
|
||||
local bOk, Answer = EgtRedisAsyncSubscribeOneMessage( nRedisConnectionId, AnswerChannel, 5000)
|
||||
local bOk, Answer = EgtRedisAsyncSubscribeOneMessage( s_nRedisConnectionId, AnswerChannel, 5000)
|
||||
if bOk then
|
||||
-- EgtOutLog( 'Risposta Redis ricevuta:' .. Answer)
|
||||
EgtOutLog( 'Risposta Redis ricevuta')
|
||||
@@ -5655,15 +5654,15 @@ end
|
||||
-- funzione che aggiunge l'hardware
|
||||
function WinCalculate.AddHardware( nAreaId, bMachiningList, bHardwareList, bPositionList, bOptionList)
|
||||
-- connessione a Redis
|
||||
local bDisconnect = true
|
||||
if WDG.REDISID and WDG.REDISID > 0 then
|
||||
bDisconnect = false
|
||||
nRedisConnectionId = WDG.REDISID
|
||||
else
|
||||
local bRedisConnect, nRedisConnectionId = EgtRedisAsyncConnect( 'redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true')
|
||||
local bRedisConnect = false
|
||||
if WDG and WDG.REDISID and WDG.REDISID > 0 then
|
||||
-- connessione già creata dall'esterno
|
||||
s_nRedisConnectionId = WDG.REDISID
|
||||
elseif s_nRedisConnectionId == 0 then
|
||||
-- se nessuna connessione la creo
|
||||
bRedisConnect, s_nRedisConnectionId = EgtRedisAsyncConnect( 'redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true')
|
||||
if not bRedisConnect then
|
||||
bDisconnect = false
|
||||
EgtOutLog('Errore! Impossibile connettersi con il server Redis dal Lua!')
|
||||
EgtOutLog( 'Errore! Impossibile connettersi con il server Redis dal Lua!')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5687,8 +5686,10 @@ function WinCalculate.AddHardware( nAreaId, bMachiningList, bHardwareList, bPosi
|
||||
local OutputOptionList = {}
|
||||
AddHardwareRec( nAreaId, nReturnMode, OutputKitList, OutputPositionList, OutputOptionList)
|
||||
|
||||
if bDisconnect then
|
||||
EgtRedisAsyncDisconnect()
|
||||
-- se la connessione è stata creata in questa funzione la chiudo
|
||||
if bRedisConnect then
|
||||
EgtRedisAsyncDisconnect( s_nRedisConnectionId)
|
||||
s_nRedisConnectionId = 0
|
||||
end
|
||||
|
||||
return OutputKitList, OutputPositionList, OutputOptionList
|
||||
|
||||
Reference in New Issue
Block a user