I have a usercontrol which
loads +100 xml files and synchronize the nodes with the umbraco tree. It is a time
consuming operation and the browser times out.
What is the right way to attack
this situation? My first tough was a progress bar but haven’t found any useful
pages on google..
For now I have changed the
timeout I web.config to 3hours but I don’t think that’s a pretty way to solve
the problem.
foreach(xmlfile)
{
… sync
}
Any toughs
on best practice to implement time consuming functions In umbraco?
- implement as windows app (e.g. service) if possible, as will have quite an impact on the server it's best run at off-peak times
- definitely use something like a background worker or another low priority thread
- any chance you can merge the +100 xml files and then do 1 sync with the Umbraco system?
- if you have to impelement it so it runs in the browser you can nevertheless use a background worker process, providing updates to the user is a must in this case. You can easily optain progress information from the background process and display that, e.g. after each feed done or so.
Needless to say if you can get around this whole business somehow and do it in another way that might be even easier. E.g. if your website does more than showing the sync'ed feeds you could create a separate app with a separate DAL, you won't have Umbraco nodes this way though, but could write a small dashboard app so users can still work with the data.
I think the background procss or windows service is the way to go.
You could create an Umbraco scheduled task that reads the XML files into a database. The Umbraco tree could then read directly form the DB, only requesting the child nodes that are required.
time consuming function and timeout
I have a usercontrol which loads +100 xml files and synchronize the nodes with the umbraco tree. It is a time consuming operation and the browser times out.
What is the right way to attack this situation? My first tough was a progress bar but haven’t found any useful pages on google..
For now I have changed the timeout I web.config to 3hours but I don’t think that’s a pretty way to solve the problem.
foreach(xmlfile) {
… sync
}
Any toughs on best practice to implement time consuming functions In umbraco?
Hi Michael,
just my 5 cents:
- implement as windows app (e.g. service) if possible, as will have quite an impact on the server it's best run at off-peak times
- definitely use something like a background worker or another low priority thread
- any chance you can merge the +100 xml files and then do 1 sync with the Umbraco system?
- if you have to impelement it so it runs in the browser you can nevertheless use a background worker process, providing updates to the user is a must in this case. You can easily optain progress information from the background process and display that, e.g. after each feed done or so.
Needless to say if you can get around this whole business somehow and do it in another way that might be even easier. E.g. if your website does more than showing the sync'ed feeds you could create a separate app with a separate DAL, you won't have Umbraco nodes this way though, but could write a small dashboard app so users can still work with the data.
Sascha
Nice ideas Sascha,
I think the background procss or windows service is the way to go.
You could create an Umbraco scheduled task that reads the XML files into a database. The Umbraco tree could then read directly form the DB, only requesting the child nodes that are required.
Cheers,
Chris
How about cms import? http://www.cmsimport.com/
Thanks for your replies.. i did go the background worker way..
is working on a reply...