Skip to content

Commit 283a4c9

Browse files
committed
Clean up closing protocol handlers
1 parent 91d129e commit 283a4c9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

app/protocols/fetch-to-handler.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ module.exports = function fetchToHandler (getFetch, session) {
77

88
async function load () {
99
try {
10-
if (hasFetch) return hasFetch
11-
if (loadingFetch) return loadingFetch
10+
if (hasFetch) return hasFetch
11+
if (loadingFetch) return loadingFetch
1212

13-
loadingFetch = Promise.resolve(getFetch()).then((fetch) => {
14-
hasFetch = fetch
15-
return fetch
16-
})
13+
loadingFetch = Promise.resolve(getFetch()).then((fetch) => {
14+
hasFetch = fetch
15+
return fetch
16+
})
1717

18-
return loadingFetch
18+
return loadingFetch
1919
} finally {
2020
loadingFetch = null
2121
}
@@ -38,6 +38,7 @@ module.exports = function fetchToHandler (getFetch, session) {
3838
await loadingFetch
3939
await close()
4040
} else if (hasFetch) {
41+
console.log('Closing')
4142
if (hasFetch.close) await hasFetch.close()
4243
else if (hasFetch.destroy) await hasFetch.destroy()
4344
}

0 commit comments

Comments
 (0)