Skip to content

Commit

Permalink
Added retries to scene loading (#3418)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Yau <[email protected]>
  • Loading branch information
yaustar and steveny-sc authored Aug 19, 2021
1 parent 0afb685 commit 957f717
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/resources/hierarchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HierarchyHandler {
}

load(url, callback) {
SceneUtils.load(url, callback);
SceneUtils.load(url, this.maxRetries, callback);
}

open(url, data) {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/scene-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class SceneSettingsHandler {
}

load(url, callback) {
SceneUtils.load(url, callback);
SceneUtils.load(url, this.maxRetries, callback);
}

open(url, data) {
Expand Down
7 changes: 4 additions & 3 deletions src/resources/scene-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ const SceneUtils = {
* @name SceneUtils.load
* @description Loads the scene JSON file from a URL.
* @param {string} url - URL to scene JSON.
* @param {number} maxRetries - Number of http load retry attempts.
* @param {Function} callback - The callback to the JSON file is loaded.
*/
load: function (url, callback) {
load: function (url, maxRetries, callback) {
if (typeof url === 'string') {
url = {
load: url,
Expand All @@ -19,8 +20,8 @@ const SceneUtils = {
}

http.get(url.load, {
retry: this.maxRetries > 0,
maxRetries: this.maxRetries
retry: maxRetries > 0,
maxRetries: maxRetries
}, function (err, response) {
if (!err) {
callback(err, response);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SceneHandler {
}

load(url, callback) {
SceneUtils.load(url, callback);
SceneUtils.load(url, this.maxRetries, callback);
}

open(url, data) {
Expand Down

0 comments on commit 957f717

Please sign in to comment.