I have a scheduled import task that runs nightly on our CM instance. The task is huge - it pulls tens of thousands of products from an API and updates, creates, or deletes all of the corresponding product items in the Sitecore database. When I trigger the task manually, it takes about an hour to complete.
The task runs nightly but often, we find that certain products haven't synced, or they've updated but didn't get published. Based on the logs, it appears that the process just stops. We have a custom logger that writes to Custom.log for this import. It writes a message that it is starting the import; that it is making each API call (for each product type); each product ID that is successfully imported or that fails; a message that it has completed importing; and some logging during the publishing.
The thing is that the logs just end. I never get to this line:
_Logger.Info("ProductsSync: Finished; publishing products");
I'll have thousands of product completion lines logged, and then the log just ends. There's no error; if there was, I would get this line in the logs, but there's no errors in Custom.log, or in log.txt
_Logger.Error(String.Format("Error on ExecuteProductSync ") + ex.Message);
Below is a picture showing how the logs just stop abruptly
So I expect the issue is that the app is recycling or going to sleep or something, and this is aborting the scheduled task. I do have keepalive in my CM instance:
<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">
<param desc="url">/sitecore/service/keepalive.aspx</param>
<LogActivity>true</LogActivity>
</agent>
so why would it be stopping/restarting, and how can I prevent it from doing so while the task is running?