Question
· Feb 6, 2019

Business Service Delete Error

While processing large HL7 files via ftp the Business Service errors when trying to deleting the file.  All the messages process fine just the delete step errors.  Is there is setting that would help this?

Discussion (5)0
Log in or sign up to continue

We would want the Business Service to delete the file, which it can do just fine if the file is smaller.  I have tried a file in the KB; file is deleted no error.  Same process tried a file 34 megs and the delete error happens.  It seems like it might be trying to delete the file before the Business Service or Business operation has finished processing the messages so it see the file as being is use.  If so that is true, is there a way to slow down the delete process to give time for the give time for processing to finish.

Have had a similar problem.  Likely the issue is your FTP server needs to increase its timeout settings.  
 

You could try extending the FTP adapter and overriding the delete method as follows:

Method delete(pFilename As %String, pFileDir As %String) As %Boolean
{
Set tSC=..setFilePath(pFileDir,.tOldDir) If $$$ISERR(tSC) $$$LOGSTATUS(tSC) Quit 0 }
Set tOK=$S(..%isSFTP:..FTP.DeleteSSH(pFilename),1:..FTP.Delete(pFilename))

if 'tOK

{

if ..Connected set tSC=..Disconnect(1)
Set tSC=..Connect(..ConnectTimeout,1)
Set tOK=$S(..%isSFTP:..FTP.DeleteSSH(pFilename),1:..FTP.Delete(pFilename))

}
Do:'tOK ..disconnectOnNetErr(,1)
If ..Connected Set tSC=..restoreFilePath(tOldDir) If $$$ISERR(tSC) $$$LOGSTATUS(tSC) Quit 0 }
Quit tOK
}

If tOK returns an error, you failed to delete.  this change will disconnect from the server, reconnect and delete again.  As the most likely issue is you are not connected this will work around your ftp server's timeout.  

The other option is to update your FTP server to have a larger timeout window.