Skip to content

Commit 459f9ba

Browse files
committed
Explicit async
1 parent 4623ebb commit 459f9ba

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/AssetCache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class AssetCache {
275275
return fs.readFileSync(contentPath, type !== "buffer" ? "utf8" : null);
276276
}
277277

278-
getCachedContents(type) {
278+
async getCachedContents(type) {
279279
if(!this.#rawContents[type]) {
280280
this.#rawContents[type] = this.#getCachedContents(type);
281281
}

src/RemoteAssetCache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class RemoteAssetCache extends AssetCache {
207207

208208
// async but not explicitly declared for promise equality checks
209209
// returns a Promise
210-
fetch(optionsOverride = {}) {
210+
async fetch(optionsOverride = {}) {
211211
if(!this.#fetchPromise) {
212212
// one at a time. clear when finished
213213
this.#fetchPromise = this.#fetch(optionsOverride).finally(() => {

test/QueueTest.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,9 @@ test("Raw Fetch using fetch method (check parallel fetch promise reuse)", async
202202
// Make sure the instance is the same
203203
t.is(ac1, ac2);
204204

205-
let fetch1 = ac1.fetch();
206-
let fetch2 = ac1.fetch();
207-
t.is(fetch1, fetch2);
205+
let [result1, result2] = await Promise.all([ac1.fetch(), ac1.fetch()]);
208206

209-
t.is(await fetch1, await fetch2);
207+
t.is(result1, result2);
210208

211209
t.false(ac1.wasLastFetchCacheHit())
212210

0 commit comments

Comments
 (0)