aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/webtorrent/peertube-chunk-store.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-17 14:42:53 +0200
committerChocobozzz <me@florianbigard.com>2021-08-18 08:35:06 +0200
commit9df52d660feb722404be00a50f3c8a612bec1c15 (patch)
treedde52880fa012874d24c60f64eb596b0a789cc8b /client/src/assets/player/webtorrent/peertube-chunk-store.ts
parentadb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff)
downloadPeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz
PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst
PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip
Migrate client to eslint
Diffstat (limited to 'client/src/assets/player/webtorrent/peertube-chunk-store.ts')
-rw-r--r--client/src/assets/player/webtorrent/peertube-chunk-store.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/webtorrent/peertube-chunk-store.ts
index 66762bef8..93ca8e1d8 100644
--- a/client/src/assets/player/webtorrent/peertube-chunk-store.ts
+++ b/client/src/assets/player/webtorrent/peertube-chunk-store.ts
@@ -36,7 +36,7 @@ export class PeertubeChunkStore extends EventEmitter {
36 36
37 chunkLength: number 37 chunkLength: number
38 38
39 private pendingPut: { id: number, buf: Buffer, cb: Function }[] = [] 39 private pendingPut: { id: number, buf: Buffer, cb: (err?: Error) => void }[] = []
40 // If the store is full 40 // If the store is full
41 private memoryChunks: { [ id: number ]: Buffer | true } = {} 41 private memoryChunks: { [ id: number ]: Buffer | true } = {}
42 private databaseName: string 42 private databaseName: string
@@ -54,7 +54,7 @@ export class PeertubeChunkStore extends EventEmitter {
54 this.databaseName = 'webtorrent-chunks-' 54 this.databaseName = 'webtorrent-chunks-'
55 55
56 if (!opts) opts = {} 56 if (!opts) opts = {}
57 if (opts.torrent && opts.torrent.infoHash) this.databaseName += opts.torrent.infoHash 57 if (opts.torrent?.infoHash) this.databaseName += opts.torrent.infoHash
58 else this.databaseName += '-default' 58 else this.databaseName += '-default'
59 59
60 this.setMaxListeners(100) 60 this.setMaxListeners(100)
@@ -106,7 +106,9 @@ export class PeertubeChunkStore extends EventEmitter {
106 } catch (err) { 106 } catch (err) {
107 console.log('Cannot bulk insert chunks. Store them in memory.', { err }) 107 console.log('Cannot bulk insert chunks. Store them in memory.', { err })
108 108
109 processing.forEach(p => this.memoryChunks[ p.id ] = p.buf) 109 processing.forEach(p => {
110 this.memoryChunks[p.id] = p.buf
111 })
110 } finally { 112 } finally {
111 processing.forEach(p => p.cb()) 113 processing.forEach(p => p.cb())
112 } 114 }