Repository: brave/browser-laptop (JavaScript)

Issue:
reducing time for the ref headers fetch at startup
## Test plan


1. download `0.23.104`
2. create an empty brave profile and add `promoCode` which includes `dowjones-barrons` or `dowjones-marketwatch`
3. launch brave, you should see a `dj-barrons` or `dj-marketwatch` tab at startup

## Original Issue

<!--
Have you searched for similar issues? We have received a lot of feedback and bug reports that we have closed as duplicates. Before submitting this issue, please visit our community site for common ones: https://community.brave.com/c/common-issues
-->

### Description
<!--
[Description of the issue]
-->

Because of https://github.com/brave/browser-laptop/pull/14620, we fetch the headers anywhere between 30s -1min after startup. Because of this change, users won't see the promotion tab at startup when installing either MW/Barrons (dowjones promotion). Users might not wait the 1min and just assume that the promotion is either over or broken.

### Steps to Reproduce
<!--
Please add a series of steps to reproduce the problem. See https://stackoverflow.com/help/mcve for in depth information on how to create a minimal, complete, and verifiable example.
-->

  1. Download one of the promotional executables from either https://brave.com/dowjones-barrons or https://brave.com/dowjones-marketwatch
  2. Once downloaded, install the build and launch Brave
  3. Wait 30s - 1min and you'll notice the promotional tab will finally appear

**Actual result:**
<!--
Please add screenshots if needed.
-->

https://youtu.be/KhM8GmenI4k

**Expected result:**

Promotional tabs should appear a few seconds after startup and not 30s -1min after startup. Might give the users the impressing that it's either broken or the promotion has ended.

**Reproduces how often:**
<!--
What percentage of the time does it reproduce?
-->

100% reproducible using the above STR.

### Brave Version

**about:brave info:**
<!--
Please open about:brave, copy the version information, and paste it.
-->

```
Brave: 0.23.79 
V8: 6.8.275.24 
rev: 51b49051a779f0db94fbcfd0df5faca781299ea0 
Muon: 8.0.7 
OS Release: 17.7.0 
Update Channel: Release 
OS Architecture: x64 
OS Platform: macOS 
Node.js: 7.9.0 
Brave Sync: v1.4.2 
libchromiumcontent: 68.0.3440.84
```

**Reproducible on current live release:**
<!--
Is this a problem with the live build? It matters for triage reasons.
-->

Yes, currently reproducible on `0.23.79` 51b49051a779f0db94fbcfd0df5faca781299ea0 which is the current live version.

### Additional Information
<!--
Any additional information, related issues, extra QA steps, configuration or data that might be necessary to reproduce the issue.
-->



Discussion:
Verified on Windows 10 x64
* 0.23.104 b454a4a
* Muon `8.0.8`
* libchromiumcontent  `68.0.3440.84`

Verified on `macOS 10.13.6 x64` using the following builds:

* 0.23.104 b454a4a
* muon `8.0.8`
* libchromiumcontent  `68.0.3440.84`





Patch:
diff --git a/app/browser/api/ledger.js b/app/browser/api/ledger.js
index 800db6f6c70..12f34110c80 100644
--- a/app/browser/api/ledger.js
+++ b/app/browser/api/ledger.js
@@ -87,7 +87,6 @@ let promotionTimeoutId
 let togglePromotionTimeoutId
 let publisherInfoTimeoutId = false
 let publisherInfoUpdateIntervalId
-let promoRefFetchTimeoutId = false
 
 const statePath = 'ledger-state.json'
 
@@ -2278,13 +2277,7 @@ const initialize = (state, paymentsEnabled) => {
 }
 
 const schedulePromoRefFetch = () => {
-  if (promoRefFetchTimeoutId) {
-    clearTimeout(promoRefFetchTimeoutId)
-  }
-
-  promoRefFetchTimeoutId = setTimeout(() => {
-    appActions.onPromoRefFetch()
-  }, random.randomInt({min: 50 * ledgerUtil.milliseconds.second, max: 70 * ledgerUtil.milliseconds.second}))
+  appActions.onPromoRefFetch()
 }
 
 const onRunPromoRefFetch = (state) => {


Test patch:
diff --git a/test/unit/app/browser/api/ledgerTest.js b/test/unit/app/browser/api/ledgerTest.js
index 899b9b962f1..7dbffd49b21 100644
--- a/test/unit/app/browser/api/ledgerTest.js
+++ b/test/unit/app/browser/api/ledgerTest.js
@@ -2711,17 +2711,13 @@ describe('ledger api unit tests', function () {
   })
 
   describe('schedulePromoRefFetch', function () {
-    const fortySeconds = 40000
-    const seventySeconds = 70000
-    let fakeClock, onPromoRefFetchSpy
+    let onPromoRefFetchSpy
 
     before(function () {
-      fakeClock = sinon.useFakeTimers()
       onPromoRefFetchSpy = sinon.spy(appActions, 'onPromoRefFetch')
     })
 
     after(function () {
-      fakeClock.restore()
       onPromoRefFetchSpy.restore()
     })
 
@@ -2729,17 +2725,10 @@ describe('ledger api unit tests', function () {
       onPromoRefFetchSpy.reset()
     })
 
-    it('dispatches onPromoRefFetch after 50 - 70 seconds', function () {
+    it('dispatches onPromoRefFetch', function () {
       ledgerApi.schedulePromoRefFetch(defaultAppState)
-      fakeClock.tick(seventySeconds)
       assert(onPromoRefFetchSpy.calledOnce)
     })
-
-    it('does not dispatch onPromoRefFetch after 40 seconds', function () {
-      ledgerApi.schedulePromoRefFetch(defaultAppState)
-      fakeClock.tick(fortySeconds)
-      assert(onPromoRefFetchSpy.notCalled)
-    })
   })
 
   describe('onRunPromoRefFetch', function () {