Gradle Build Slow - taking 4 hours to complete once every 24 hours

We are seeing an issue with our Gradle build. The build usually take 40 minutes to finish but once in every 24 hours it takes around 4 hours. As we know that snapshots are cached but expire after some time (24 hours by default).What configuration changes we need to look into to fix this issue in a way that we can specify the time when to refresh if that is the potential issue. If there is any similar issue reported what is the resolution to that. We are using Gradle version – 1.7

hey,

using over 3 hours for refreshing your dependencies seems like a lot.
you have the same performance when running your build locally by using
"–refresh-dependencies" flag?

You can configure the refreshing ttl by using the following snippet:

configurations.all {
    resolutionStrategy {
        // cache dynamic versions for 10 minutes
        cacheDynamicVersionsFor 30, 'hours'
        // don't cache changing modules at all
        cacheChangingModulesFor 30, 'hours'
    }
}

Hello,
I am in the same team as Pankaj who raised the issue before and wonder if there is a fix for the Cache slowness issue. I can provide more details of the build.gradle file and such. The default timeout for the cache is 24 hours but I know we can extend that window. However, it would probably be just a temp fix. We need some permanent fix.
Any suggestions are greatly appreciated,

Thank you in Advance!
Abe