Testing restartable jobs

Vote:
 

Previously posted a forum post about my long running import falling over after 20 minutes, which appears to be a common theme when IIS is concerned. 'ContentRepo.Save' was just throwing an error, no logic errors or anything, so I've decided to use a restartable job instead.

How do I test it, ie. how do I crash and restart episerver such that it restarts the job correctly, and also, is there a way for me to debug this process? At present, I found the process in taskmanager and just ended it, but that killed by debug session, which is ok, but now I cant see any evidence that it restarted and re-attaching in visual studio doesn't look like it's running

#217552
Feb 25, 2020 16:54
Vote:
 

Hi Noel

Below is my 2c.

Change your website application pool idle timeout setting to smaller value instead of default 20 mins. Modify your schedule job to write your evidence to log file instead of attaching to debugger. 

#217582
Edited, Feb 26, 2020 1:41
Vote:
 

Can't you add Debugger.Launch() to the start of your Execute method? When your site restarts and your job is started again, that would ask you to attach to a debugger ... Or you need something else?

#217590
Feb 26, 2020 7:58
Vote:
 

Wow, two very useful answers, thank you Vincent and Quan, I'll try them both. Quan gets the accepted answer cause he actually gave me some code which i wasn't expecting

#217594
Feb 26, 2020 8:55
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.