For development, I am using a special setup, trying to reduce time from compilation to browser refresh without any issues.
For this I have to use HyperServer, due to is ability to automatically reload a new application file, from the deploy folder.
So I run a webserver on my development PC, apache 2.2, and I have a post-compile event in Delphi which copies the EXE file
to the \deploy folder, renaming it to *.dep.
I have a timer in the mainForm which discovers that the HyperServer has loaded the new application file:
procedure TMainForm.reloadTimerTimer(Sender: TObject);
begin
with uniMainModule do
if newFileDate<>fileDate then
begin
reloadTimer.Enabled:=false;
showToast('Reloading application...');
uniSession.AddJS('document.location.reload();');
end;
end;
This works fine, and it runs this newFileDate function in the MainModule:
function TUniMainModule.newFileDate:TDateTime;
var fileDateInt:Integer;
begin
fileDateInt := fileAge('c:\antirust\timebok\timebok.exe');
if fileDateInt > -1 then
result:=fileDateToDateTime(fileDateInt);
end;
Of course this function is also run at MainModule startup:
procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject);
begin
fileDate:=newFileDate;
end;
The MainForm timer runs at 500ms intervals, so this all works fine, as you can see in the screenshot.
But - there is of course another timer running in the HyperServer, and I wonder how I can reduce its interval?
It seems like the HyperServer timer runs at 10 secs interval, and I would like to lower it to about 1 second.
Then I can reduce the time from compile to browser reload, to about 3 seconds - maybe.