Hi guys,
As part of a strategy for scalling out our Portal Sharepoint MySites which is over 250k mysites, we decided to create an approach which is:
1- Create a PowerShell custom Job which will run twice a month looking for unuseful mysites and remove them gradually.
2- The users which lost the mysite due custom Powershell job will be redirected into a common page for users that does not edit their sites. It will avoid having too many mysites.
3- If the user over the common static home page decided to edit (Add new web parts, Add pages, etc) we need to create a personal mysite then.
All this is working except for the #3 which works partially.
When an user confirm its edition from a Sharepoint popup we will call a RESTFul service throught jQuery Ajax async in order to leave the service the task to create mysite while it shows a wait page upon the client side (the important thing here is the callback).
Above is the Ajax call. When this call is performed we need to assume the following:
1- The user already lost mysite due to auto-deletion from powershell script.
2- There is no personal site for this user calling the service.
3- We will create a site for the user.
So we are sure the site its not present, the rest ful function is:
This function is throwing out a PersonalSiteExistsException even when the site is not present.
When it works:
When I recycle the application pool after deleting personal sites, the exception is not trow and the site is created properly.
I guess there is something in the cache but I cannot realize on what is causing the exception.
Could someone guide me¡
Thanks a lot.
?width=750
As an update… Pretty sure its to do with a dodgy SPSite.Exists() method that get’s called internally in your method. There’s quite a bit on Google about it.
This comment by Chris Beckett is also really helpful :
It’s not a cache problem. In 2010 they implemented a timer job to do the actual site collection deletion called Gradual Site Deletion to help manage database locks when deleting large site collections. The actual deletion usually occurs very quickly, but it can take up to a few minutes.