Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorftreesmilo <58193105+ftreesmilo@users.noreply.github.com>2020-12-08 04:26:09 +0300
committerKaylee <34007889+KayleePop@users.noreply.github.com>2020-12-11 06:40:19 +0300
commit2d78a30a72072b859336f8d9340398d6bb2169e0 (patch)
treea509cbfc2587905ca630300df6a93023c40801e4 /lib/server.js
parent38f4f9c846b036fcd4b53a96ff151bc105b38c11 (diff)
replace process.nextTick with queueMicrotask
Diffstat (limited to 'lib/server.js')
-rw-r--r--lib/server.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/server.js b/lib/server.js
index cc33159..85b4573 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -4,6 +4,7 @@ const http = require('http')
const mime = require('mime')
const pump = require('pump')
const rangeParser = require('range-parser')
+const queueMicrotask = require('queue-microtask')
function Server (torrent, opts = {}) {
const server = http.createServer()
@@ -40,7 +41,7 @@ function Server (torrent, opts = {}) {
// Only call `server.close` if user has not called it already
if (!cb) cb = () => {}
- if (closed) process.nextTick(cb)
+ if (closed) queueMicrotask(cb)
else server.close(cb)
torrent = null
}