]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / p2p-media-loader / redundancy-url-manager.ts
index 7fc2b6ab1e942ce51063831661339667235ce350..abab8aa99e3524c739c39d3a780cd5c2f5bbe191 100644 (file)
@@ -2,9 +2,6 @@ import { basename, dirname } from 'path'
 
 class RedundancyUrlManager {
 
-  // Remember by what new URL we replaced an origin URL
-  private replacedSegmentUrls: { [originUrl: string]: string } = {}
-
   constructor (private baseUrls: string[] = []) {
     // empty
   }
@@ -17,16 +14,7 @@ class RedundancyUrlManager {
     this.baseUrls = this.baseUrls.filter(u => u !== baseUrl && u !== baseUrl + '/')
   }
 
-  removeByOriginUrl (originUrl: string) {
-    const replaced = this.replacedSegmentUrls[originUrl]
-    if (!replaced) return
-
-    return this.removeBySegmentUrl(replaced)
-  }
-
   buildUrl (url: string) {
-    delete this.replacedSegmentUrls[url]
-
     const max = this.baseUrls.length + 1
     const i = this.getRandomInt(max)
 
@@ -35,10 +23,7 @@ class RedundancyUrlManager {
     const newBaseUrl = this.baseUrls[i]
     const slashPart = newBaseUrl.endsWith('/') ? '' : '/'
 
-    const newUrl = newBaseUrl + slashPart + basename(url)
-    this.replacedSegmentUrls[url] = newUrl
-
-    return newUrl
+    return newBaseUrl + slashPart + basename(url)
   }
 
   countBaseUrls () {