One of our requirement was to execute a long running job in Sitecore Content Tree. In many cases, we end up in Timed out error. Obviously we can increase request timed out configuration. But Sitecore has a very good way of executing such long running task in a ProgressBox.
ProgressBox.Execute(JobName, JobTitle, ProgressBoxMethod, Params);
ProgressBox.Execute("Job Name", "Job Title ", new ProgressBoxMethod(ExecuteOperation), item);
This line of code will start progress box and the functionality will be executed in the ProgressBoxMethod.
protected void ExecuteOperation(params object parameters)
//Do the operations
//Logging for the job
Sitecore.Context.Job.Status.Messages.Add("Logs for the job: JobName");
//Is the job done?
//On completing the job
By using the progress box, the long running tasks are executed successfully without getting any timed out errors. This has other methods to handle the queuing asynchronously.