-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a lock instead of an init queue to the restore() operation.
- Loading branch information
Showing
2 changed files
with
6 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ public class GitStore : IAssetsStore | |
public static readonly string GIT_COMMIT_OWNER_ENV_VAR = "GIT_COMMIT_OWNER"; | ||
public static readonly string GIT_COMMIT_EMAIL_ENV_VAR = "GIT_COMMIT_EMAIL"; | ||
private bool LocalCacheRefreshed = false; | ||
public readonly object LocalCacheLock = new object(); | ||
|
||
public GitStoreBreadcrumb BreadCrumb = new GitStoreBreadcrumb(); | ||
|
||
|
@@ -511,16 +512,14 @@ public static string GetCloneUrl(string assetsRepo, string repositoryLocation, b | |
/// <param name="config"></param> | ||
public bool IsAssetsRepoInitialized(GitAssetsConfiguration config) | ||
{ | ||
// we have to ensure that multiple threads hitting this same segment of code won't stomp on each other | ||
if (!LocalCacheRefreshed) | ||
// we have to ensure that multiple threads hitting this same segment of code won't stomp on each other. restore is incredibly important. | ||
This comment has been minimized.
Sorry, something went wrong.
scbedd
Author
Member
|
||
lock (LocalCacheLock) | ||
{ | ||
var breadCrumbQueue = InitTasks.GetOrAdd("breadcrumbload", new TaskQueue()); | ||
breadCrumbQueue.Enqueue(() => | ||
if (!LocalCacheRefreshed) | ||
{ | ||
|
||
BreadCrumb.RefreshLocalCache(Assets, config); | ||
LocalCacheRefreshed = true; | ||
}); | ||
} | ||
} | ||
|
||
if (Assets.ContainsKey(config.AssetsJsonRelativeLocation.ToString())) | ||
|
I can't recall the git config, but for some, the
.git
is a file not a folder.