diff --git a/app/domain/DolphinManager.js b/app/domain/DolphinManager.js index cc6c3d714..2406be052 100644 --- a/app/domain/DolphinManager.js +++ b/app/domain/DolphinManager.js @@ -4,6 +4,8 @@ import fs from 'fs-extra'; import path from 'path'; import os from 'os'; import crypto from 'crypto'; +import retry from 'async-retry'; +import log from 'electron-log'; import { getDolphinPath } from '../utils/settings'; @@ -63,7 +65,18 @@ export default class DolphinManager { commandId: uniqueId, // Indicates to Dolphin to play new replay }); - fs.writeFileSync(this.outputFilePath, jsonString); + await retry(() => { + log.info(`Writing to Dolphin comm file, playing replay: ${filePath}`); + fs.writeFileSync(this.outputFilePath, jsonString); + }, { + retries: 5, + factor: 1, + minTimeout: 100, + maxTimeout: 300, + onRetry: (err) => { + log.error("Encountered error trying to write to Dolphin comm file.", err); + }, + }); if (startDolphin) { await this.runDolphin(true); diff --git a/package.json b/package.json index 33dd31820..ae23b0221 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "slippi-desktop-app", "productName": "Slippi Desktop App", - "version": "1.4.4", + "version": "1.4.5", "description": "Slippi Desktop App for browsing and playing replays.", "scripts": { "build": "concurrently \"yarn build-main\" \"yarn build-renderer\"", @@ -256,6 +256,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "^5.5.0", "@google-cloud/storage": "^2.4.2", + "async-retry": "^1.2.3", "classnames": "^2.2.6", "devtron": "^1.4.0", "electron-debug": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 0a4e92d86..681b2c1b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1753,6 +1753,13 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== +async-retry@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.2.3.tgz#a6521f338358d322b1a0012b79030c6f411d1ce0" + integrity sha512-tfDb02Th6CE6pJUF2gjW5ZVjsgwlucVXOEQMvEX9JgSJMs9gAX+Nz3xRuJBKuUYjTSYORqvDBORdAQ3LU59g7Q== + dependencies: + retry "0.12.0" + async@0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/async/-/async-0.2.6.tgz#ad3f373d9249ae324881565582bc90e152abbd68" @@ -11044,6 +11051,11 @@ retry-request@^4.0.0: dependencies: through2 "^2.0.0" +retry@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= + rgb-regex@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1"