This commit is contained in:
Алексей Заблоцкий 2023-10-19 09:43:08 +03:00
parent e93b74e31b
commit 167b2d7d71
3 changed files with 13 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -76,7 +76,9 @@
<Unit>
<Filename Value="connectionsdmunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ConnectionsDM"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="DataModule"/>
<UnitName Value="ConnectionsDmUnit"/>
</Unit>
<Unit>