Try using low Gradle priority instead of capping workers
MODIFY
gradle.properties
gradle.properties
org.gradle.parallel=true
org.gradle.caching=true
-# limiting the number of parallel workers helps to keep your machine responsive during builds
-# see https://github.com/gradle/gradle/issues/14224
-org.gradle.workers.max=2
+org.gradle.priority=low
# Gradle default is 256m which causes issues with our build - https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m

Try using low Gradle priority instead of capping workers (#1538)