Closed AmadeusW closed 9 years ago
Ok I've added the locks
I think if you just change the way you do the repo.lock
file, this will work great. I think you should be able to create the file without writing to it too.
Thanks for comments and suggestions. Now we're only using the lock to designate the repository as being processed. There is no writing or reading of the lock file. When there is an error during processing, the repository directory is removed from _SBFiles\UserName
With this simplified design, there is one gotcha we should be aware of:
In BrowseController.cs
, public ActionResult LookupRepo(string username, string repository)
:
if(!BrowserRepository.PathExists(username, repository))
{
ViewBag.ErrorMessage = "Specified repository could not be found";
return this.View("LookupError");
}
Imagine the repository being uploaded in another thread. There is an error and the repo's directory is removed. Here, we've just checked if the path existed, and the check passed. We're here now:
var viewModel = BrowserRepository.SetUpSolutionStructure(username, repository, "");
if (!BrowserRepository.IsRepositoryReady(username, repository))
{
return View("AwaitLookup", "_BrowseLayout", viewModel);
}
else
{
ViewBag.TreeView = loadTreeView(username, repository);
return View("LookupFolder", "_BrowseLayout", viewModel);
}
In this peculiar scenario, the user will be taken to the AwaitLookup
page and told that the repository is being processed. After refreshing the user will see that the repository doesn't exist.
In this peculiar scenario, the user will be taken to the AwaitLookup page and told that the repository is being processed. After refreshing the user will see that the repository doesn't exist.
That's fine.
I think everything looks good with this. I'm going to merge it this afternoon and test everything out and then push to the main website.
Uses
SB_Files\UserName\RepoName\repo.lock
file to indicate whether the repository is being processed or ready. If therepo.lock
file exists, upload action redirects the user to the browse action, thereby closing #81.Introduces project
SourceBrowser.Shared
that contains constants, exceptions, and anything that any project may need (to prevent circular dependencies)SourceBrowser.Shared.Constants
defines contents of repo.lock.BrowserRepository
is the class inSourceBrowser.Site
project that interacts with the file.Lays groundwork for #82 by introducing
AwaitLookup.cshtml
page. The "await" page is visible to users who attempt browsing a repo which is being currently uploaded. In the future, this page should use SignalR to communicate with the server and show live updates of the processing, and to refresh when the processing has finished.