From 167b2d7d716b0c36e52448553ab516b6bd92cb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=97=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D1=86=D0=BA=D0=B8=D0=B9?= Date: Thu, 19 Oct 2023 09:43:08 +0300 Subject: [PATCH] setIdle --- baseconnection.pas | 12 ++++++++++-- connectionsdmunit.pas | 2 +- lms_cgi_server.lpi | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/baseconnection.pas b/baseconnection.pas index 32d9798..2d33b08 100644 --- a/baseconnection.pas +++ b/baseconnection.pas @@ -80,7 +80,7 @@ type nCommandReceived: integer; nCommandReady: integer; nErrors: integer; - + fCheckConnect: boolean; procedure CleanDone; public Host: string; @@ -109,6 +109,7 @@ type function RunCommand(ACommand: TCommand): boolean; function FindCommand(IDCommand: string): TCommand; procedure Idle; + procedure SetIdle; procedure Execute; override; function ProcessOptionValues(ReportName,ParamName: string; ParamValues: TStrings; out Answer: string; out RetValue: QWORD; out OptionValues: TStrings): boolean; class function newID: string; @@ -232,6 +233,7 @@ procedure TBaseConnection.Idle; var d: TDateTime; begin + fCheckConnect:=false; d := Created; if LastAccess>d then d := LastAccess; if (now()-d)*24*60>fTimeout then @@ -243,6 +245,11 @@ begin fProcessor.ExecuteSQL('SELECT 1'); end; +procedure TBaseConnection.SetIdle; +begin + fCheckConnect:=true; +end; + procedure TBaseConnection.CleanDone; var i: integer; @@ -286,7 +293,8 @@ begin end; end; CleanDone; - sleep(100); + if fCheckConnect then Idle; + sleep(200); end; log(self,'finished'); end; diff --git a/connectionsdmunit.pas b/connectionsdmunit.pas index 0305c51..ee631c0 100644 --- a/connectionsdmunit.pas +++ b/connectionsdmunit.pas @@ -537,7 +537,7 @@ begin MainCon.ExecuteSQL('select 1'); for i := conlist.Count-1 downto 0 do if not TBaseConnection(conList[i]).Finished then - TBaseConnection(conList[i]).Idle; + TBaseConnection(conList[i]).SetIdle; end; initialization diff --git a/lms_cgi_server.lpi b/lms_cgi_server.lpi index edd5fe9..ebb01a9 100644 --- a/lms_cgi_server.lpi +++ b/lms_cgi_server.lpi @@ -76,7 +76,9 @@ + +