NonStop Maintenances
Std Accounts Test
3-7-18
Hello,

I have a maintenance that imports data from xml files located in the server.

The maint is called with qupdating, yet still SERP freezes for all users while the import
is running.
The same happens if the function is called via background task
As far as I understand, NonStop maintenances allows system users to carry out their normal update
tasks while it runs, I need help. with locating what is wrong the below implementation :

Version 8.1 2016-02-12
Windows Server & Clients.

Selection of the relevant part of the code ..

global
updating function boolean DoClaimXmlFileImport(var string errstr)
begin
    record AKClaimSubVc ClaimSubr, oldClaimSubr;
    record AKClaimVc Claimr, Claim2r;
   
    folder = "Claims//Submissions//Imports";
tofolder = "Claims//Submissions//Imports//Processed";
    filename = GetFileNameInDir(folder,0);
    if (blank(filename)) then begin
        goto LDoClaimXmlFileImport;
    end;
    importfile = filename;
    tofilename = filename;
    filename = folder & "//" & filename;

       

    xdata = ParseXMLFile(filename);
    RecordNew(ClaimSubr);
    curstrkey = "Claim.Submission/Header/";
    senderid = XmlGet(xdata,curstrkey & "SenderID");
   
    //reading and adding data to record .....
   
   
    while (TestEOF==false) begin
        ImportField;
        NextImportLine(true);
    end;
    ClaimSubr.ImportCount = filecnt;
    ClaimSubr.ImportFileName = importfile;
    if (RecordStore(ClaimSubr,false)) then begin end;

    UpdateBrowses("AKClaimSubVc");
    MoveFile(tofilename,folder,tofolder);
    eventdate = CurrentDate;
    Logtext(0,"ClaimSubr.ImportCount: " &ClaimSubr.ImportCount);
    AKUpdateClaimHist(ClaimSubr.SerNr,"","SubImp",ClaimSubr.TransactionDate,eventdate,filecnt,eventamount,sernr,"");
    DoClaimXmlFileImport = false;
return;
end;
   

   
global
procedure ClaimXmlFileImportMn(record RcVc RepSpec)
begin
String 255 errstr;

Logtext(0,"DoClaimXmlFileImportRemote");
while (qupdating.DoClaimXmlFileImport(errstr)) begin
end;

return;
end;
Jarek Jamroszczak
3-7-18
please use idle tasks
wdinzey@dpdsoftware.ca
3-7-18
hmmm, this has been an issue for us but we understood that this happens as a result of the single stream..."idle tasks"...we will look this up..seems to be some worth knowing about. Thanks for the hint Jarek!!
Std Accounts Test
3-8-18
Thanks Jarek,

I tried with below sample, still the client freeze while the background task is updating the data.

global

updating procedure DoImportTest(string errstr)
    begin
    longint i;
    record INVc INr;
   
    i = 10000;
    While (i < 20000) begin
        LogText(0,"Step " & i);
        RecordNew(INr);
        INr.Code = i;
        RecordStore(INr,false);
        //MilliSleep(500);
        i = i + 1;
    end;

    return;
end;   

global
updating procedure ImportTest(string s)
begin
String 255 errstr;
time t;

    logtext(0,"scheduling Importtest");
DoImportTest(errstr);
NewPeriodicTask("ImportTest","ImportTest Idle Task","ImportTest","",5,"");
        return;

end;


global
updating procedure OnApplicationStartupComplete()
    BEGIN
    string 255 s;


    inner.OnApplicationStartupComplete;

    logtext(0,"test");
    if (ServerMode or SingleUserMode) then begin
        ImportTest(s);
    end;

    RETURN;
END;
Jarek Jamroszczak
3-8-18
Hello

what u used is not idle task , it is some import on startup

NewPeriodicTask should be used for example OnApplicationStartupComplete
and there are more things to consider there
and creating 20000 items will take time ......

Regards
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Back to the list
Latest Posts
David Delač
Hi Piotr, The log entry:
2024-12-14 08:40:43 0.000 CallHal(IsHansaWorldCustomer) appears because the server is running with the verbosity=debug-detailed setting in its parameters.txt file. Thi...
09:43 16 Dec 2024
Brittany McGrath
Hi Vaughn, I can confirm this has been fixed now and is live in Standard ERP 2024-11-20 Version: 85556786. Thank you. ...
10:04 10 Dec 2024