]> _ Git - fluidbook-html5.git/commitdiff
wait #6269 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Sep 2023 09:14:26 +0000 (11:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Sep 2023 09:14:26 +0000 (11:14 +0200)
js/libs/fluidbook/fluidbook.loader.js

index 9b9e37f1397a08470e7c6934f0e04e7b2bf35795..661bbb4b2829a3f5471e18bea51f7041eb984443 100644 (file)
@@ -18,6 +18,7 @@ function FluidbookLoader(fluidbook) {
     this.imageMimeType = this.format === 'jpg' ? 'image/jpeg' : 'image/png';
     this._needSeparateTextures = [];
     this.loadbalancing = false;
+    this._loadbalancingServerURL = [];
 }
 
 FluidbookLoader.prototype = {
@@ -734,8 +735,10 @@ FluidbookLoader.prototype = {
         if (!this.loadbalancing) {
             return url;
         }
-        let server = this.loadbalancing[Math.floor(Math.random() * this.loadbalancing.length)];
-        return 'https://' + server + '/' + this.fluidbook.settings.id + '_' + this.fluidbook.settings.hash + '/' + url;
+        if(this._loadbalancingServerURL[url]===undefined){
+            this._loadbalancingServerURL[url]=this.loadbalancing[Math.floor(Math.random() * this.loadbalancing.length)];
+        }
+        return 'https://' + this._loadbalancingServerURL[url] + '/' + this.fluidbook.settings.id + '_' + this.fluidbook.settings.hash + '/' + url;
     },
 
     getTexture: function (page, callback, enter) {