Skip to content

Commit

Permalink
fix pcl abort
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jul 4, 2022
1 parent 971573f commit 9409875
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ export class Cluster {
}
res.set('x-bmclapi-hash', hash)
return res.sendFile(path, {maxAge: '30d'}, (err) => {
if (!err || err?.message === 'Request aborted') {
this.counters.bytes += parseInt(res.getHeader('content-length').toString(), 10) || 0
this.counters.hits++
}
if (err) return next(err)
this.counters.bytes += Number(res.getHeader('content-length'))
this.counters.hits++
})
} catch (err) {
if (err instanceof HTTPError) {
Expand Down

0 comments on commit 9409875

Please sign in to comment.