Skip to content

Commit

Permalink
Add timeouts to complete operations and fix messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeiown committed Oct 5, 2024
1 parent 9ecc04f commit dba8850
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
"msg_74": "VXNlciBkZWNsaW5lZCB0aGUgdXBkYXRl",
"msg_75": "Tm8gQWxlcnQgU2VydmVyIHVwZGF0ZXMgYXJlIGF2YWlsYWJsZQ==",
"msg_76": "RmFpbGVkIHRvIGRvd25sb2FkIGZpbGUuIFN0YXR1cyBjb2RlOg==",
"msg_77": "UmVkaXJlY3RpbmcgdG8=",
"msg_78": "RG93bmxvYWRlZCBuZXcgdmVyc2lvbg==",
"msg_77": "UmVkaXJlY3QgdG8gZG93bmxvYWQgVVJM",
"msg_78": "QSBuZXcgdmVyc2lvbiBoYXMgYmVlbiBkb3dubG9hZGVk",
"msg_79": "RG93bmxvYWRlZCBmaWxlIGlzIGVtcHR5IG9yIGNvcnJ1cHRlZA==",
"msg_80": "VW56aXBwZWQgdXBkYXRl",
"msg_81": "UmVtb3ZlZCB6aXAgZmlsZQ==",
"msg_80": "TmV3IHZlcnNpb24gZXh0cmFjdGVkIGZyb20gdGhlIGFyY2hpdmU=",
"msg_81": "QXJjaGl2ZSBmaWxlIGlzIGRlbGV0ZWQ=",
"msg_82": "RXJyb3IgcnVubmluZyBzZXR1cDo=",
"msg_83": "RXJyb3IgZHVyaW5nIHVuemlwcGluZzo=",
"msg_84": "RXJyb3IgZG93bmxvYWRpbmcgZmlsZTo=",
Expand Down Expand Up @@ -169,11 +169,11 @@
"msg_74": "VXNlciBkZWNsaW5lZCB0aGUgdXBkYXRl",
"msg_75": "Tm8gQWxlcnQgU2VydmVyIHVwZGF0ZXMgYXJlIGF2YWlsYWJsZQ==",
"msg_76": "RmFpbGVkIHRvIGRvd25sb2FkIGZpbGUuIFN0YXR1cyBjb2RlOg==",
"msg_77": "UmVkaXJlY3RpbmcgdG8=",
"msg_78": "RG93bmxvYWRlZCBuZXcgdmVyc2lvbg==",
"msg_77": "UmVkaXJlY3QgdG8gZG93bmxvYWQgVVJM",
"msg_78": "QSBuZXcgdmVyc2lvbiBoYXMgYmVlbiBkb3dubG9hZGVk",
"msg_79": "RG93bmxvYWRlZCBmaWxlIGlzIGVtcHR5IG9yIGNvcnJ1cHRlZA==",
"msg_80": "VW56aXBwZWQgdXBkYXRl",
"msg_81": "UmVtb3ZlZCB6aXAgZmlsZQ==",
"msg_80": "TmV3IHZlcnNpb24gZXh0cmFjdGVkIGZyb20gdGhlIGFyY2hpdmU=",
"msg_81": "QXJjaGl2ZSBmaWxlIGlzIGRlbGV0ZWQ=",
"msg_82": "RXJyb3IgcnVubmluZyBzZXR1cDo=",
"msg_83": "RXJyb3IgZHVyaW5nIHVuemlwcGluZzo=",
"msg_84": "RXJyb3IgZG93bmxvYWRpbmcgZmlsZTo=",
Expand Down
6 changes: 3 additions & 3 deletions modules/maintenance/integrityChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const checkIntegrity = async () => {
return;
}

backupConfigFiles();

const logMessage = `Performing a restore from a repository`;
const logMessage = `Performing a restore from repository`;
logEvent(logMessage);

backupConfigFiles();

exec(`start cmd /c "${recoveryBatPath}"`, (execError) => {
if (execError) {
logEvent(execError.message);
Expand Down
8 changes: 5 additions & 3 deletions modules/maintenance/updateHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ const downloadAndInstallUpdate = (latestVersion) => {
fs.unlinkSync(zipPath);
logEvent(messages.msg_81);

logEvent(messages.msg_71);

backupConfigFiles();

setTimeout(() => {
exec(`start "" "${setupPath}"`, (err) => {
if (err) {
Expand All @@ -87,7 +91,7 @@ const downloadAndInstallUpdate = (latestVersion) => {
});
});
} else if (response.statusCode === 302 && response.headers.location) {
logEvent(`${messages.msg_77} ${response.headers.location}`);
logEvent(messages.msg_77);
downloadFile(response.headers.location);
} else {
logEvent(`${messages.msg_76} ${response.statusCode}`);
Expand Down Expand Up @@ -134,8 +138,6 @@ const checkForUpdates = () => {
if (error) {
if (error.code === 6) {
logEvent(messages.msg_73);
backupConfigFiles();
logEvent(messages.msg_71);
downloadAndInstallUpdate(latestVersion);
} else if (error.code === 7) {
logEvent(messages.msg_74);
Expand Down

0 comments on commit dba8850

Please sign in to comment.