Skip to content

Commit 40bfc21

Browse files
committed
Avoid concurrent git calls
1 parent 17ae104 commit 40bfc21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Worker.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ void Worker::handleGetRequest(const String& repoUrl, const String& repo, const S
383383

384384
// info response
385385
{
386+
NamedMutexGuard guard(cacheDir);
387+
386388
String command = String("git-upload-pack --stateless-rpc --advertise-refs \"") + cacheDir + "\"";
387389
Log::infof("%s", (const char*)command);
388390
Process process;
@@ -423,6 +425,8 @@ void Worker::handlePostRequest(const String& repo, const String& auth, Buffer& b
423425
String cacheDir = _settings.cacheDir + "/" + repo;
424426

425427
{
428+
NamedMutexGuard guard(cacheDir);
429+
426430
String command = String("git-upload-pack --stateless-rpc \"") + cacheDir + "\"";
427431
Log::infof("%s", (const char*)command);
428432
Process process;

0 commit comments

Comments
 (0)