@@ -70,13 +70,15 @@ void runWithScopedGit(GitFunction r) {
7070 setScope (new GitScope ("PLATFORM CHANGE" ));
7171 }
7272 try {
73- if (!scopeLock .tryLock (10 , TimeUnit .SECONDS )) {
74- // This is a pretty serious error condition which should not be happening
75- // so I'm okay with doing some dirty hacks as long as we get the debug information to fix this
76- var owner = scopeLock .getOwner ();
77- var scope = ThreadLocalHack .getValueOfOtherThread (gitScopes , owner );
78- LOGGER .error ("Platform failed to obtain git lock. We're blocked on {} and waiting for it to commit: {}" , owner , scope );
79- throw new RuntimeException ("Major timeout error. Waiting on a change to be committed to git before we can start writing." );
73+ if (!this .scopeLock .isHeldByCurrentThread ()) {
74+ if (!scopeLock .tryLock (10 , TimeUnit .SECONDS )) {
75+ // This is a pretty serious error condition which should not be happening
76+ // so I'm okay with doing some dirty hacks as long as we get the debug information to fix this
77+ var owner = scopeLock .getOwner ();
78+ var scope = ThreadLocalHack .getValueOfOtherThread (gitScopes , owner );
79+ LOGGER .error ("Platform failed to obtain git lock. We're blocked on {} and waiting for it to commit: {}" , owner , scope );
80+ throw new RuntimeException ("Major timeout error. Waiting on a change to be committed to git before we can start writing." );
81+ }
8082 }
8183 // The lock is now owned by this thread, which means that our
8284 // thread scope is the active scope.
0 commit comments