Skip to content

Commit

Permalink
perf: improve packument cache callback
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Nov 2, 2022
1 parent 497386a commit 2e49493
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/main/js/firewall/packument.js
Expand Up @@ -32,17 +32,14 @@ export const getPackument = async ({boundContext, rules}) => {
: Buffer.from(JSON.stringify(_packument))
const etag = 'W/' + JSON.stringify(crypto.createHash('sha256').update(packumentBuffer.slice(0, 65_536)).digest('hex'))
const packumentZip = await gzip(packumentBuffer)
const entry = {

return {
etag,
deps,
directives,
headers,
packumentZip
}

cache.add(name, entry)

return entry
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/js/http/agent.js
Expand Up @@ -11,7 +11,7 @@ const agents = {
const agentOpts = {
keepAliveMsecs: 20_000,
keepAlive: true,
maxSockets: 20_000,
maxSockets: 1_000,
timeout: 20_000
}

Expand Down

0 comments on commit 2e49493

Please sign in to comment.