# Windows builds time out during cache restore

**URL:** <https://travis-ci.community/t/windows-builds-time-out-during-cache-restore/4642>\
**Category:** Windows\
**Tags:** caching\
**Created:** [August 8, 2019, 4:04pm UTC](https://travis-ci.community/t/windows-builds-time-out-during-cache-restore/4642 "2019-08-08T16:04:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tanzislam](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tanzislam/32/2591_2.png) [@tanzislam](https://travis-ci.community/u/tanzislam)\
**Post date:** [August 27, 2019, 9:52pm UTC](https://travis-ci.community/t/windows-builds-time-out-during-cache-restore/4642/4 "2019-08-27T21:52:33Z")

</div>

Comparing the [new download logic](https://github.com/travis-ci/casher/blob/master/bin/casher#L103) (only on Windows by default) with the [old one](https://github.com/travis-ci/casher/blob/master/bin/casher.rb#L69) (used on Linux and macOS by default), I can see that the old one used to disable [Nagle’s algorithm](https://en.wikipedia.org/wiki/Nagle%27s_algorithm) while the new one doesn’t. Might be a reason for delays.

**EDIT:** As found in [this other post](https://travis-ci.community/t/yarn-network-troubles/333/7), Windows Defender is responsible for a large chunk of the slowness. Normally you’d disable it with PowerShell commands like:

```auto
Set-MpPreference -DisableArchiveScanning $true
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableBehaviorMonitoring $true

```

… but in this case you have to execute these commands **at startup** , before the cache restore starts. I accomplished this by backticking the commands into environment variables:

```auto
env:
    global:
    - >
        DISABLE_WINDOWS_DEFENDER=`powershell -Command
        Set-MpPreference -DisableArchiveScanning \\\$true`
    - >
        DISABLE_WINDOWS_DEFENDER=`powershell -Command
        Set-MpPreference -DisableRealtimeMonitoring \\\$true`
    - >
        DISABLE_WINDOWS_DEFENDER=`powershell -Command
        Set-MpPreference -DisableBehaviorMonitoring \\\$true`

```

Now the whole build (not just the cache restore) runs much faster.

---

_[View the full topic](https://travis-ci.community/t/windows-builds-time-out-during-cache-restore/4642)._
