Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Auto Update Error Handlng Fix #14412

Merged
merged 2 commits into from
Jul 24, 2018
Merged

Auto Update Error Handlng Fix #14412

merged 2 commits into from
Jul 24, 2018

Conversation

niteskum
Copy link
Collaborator

No description provided.

@niteskum
Copy link
Collaborator Author

ping @nethip @vickramdhawal for review

@nitheshgangadharsalian
Copy link

Bug: #14411

@nethip
Copy link
Contributor

nethip commented Jun 21, 2018

@niteskum Could you provide description here as to how the bugs has been fixed? And also possible reasons as to how one can run into this error?

.done(function() {
setUpdateStateInJSON("autoUpdateInProgress", flag);
});
function nodeDomainInitialized(reset) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this getting called from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

})
.fail(initState);
} else {
initState();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that if updateJsonHandler.parse() fails, the code flow lands in initState, which in turn is calling updateJsonHandler().parse again. I think you can restucture the code for better readability as well as for proper code flow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restructured the Code. , Removed the CheckUpdateStatus() from initNode() function. Now initNode Function returns Promise . which is resolved when parsing is done. initNode is called and in done function checkUpdateStatus() function is called.


updateDomain.exec('initNode', {
messageIds: MessageIds,
updateDir: updateDir,
requester: domainID
});

updateDomain.on('data', receiveMessageFromNode);
initState();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initState() not required anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now initState() is called from nodeDomainInitialized() function. so it is not required here.

@niteskum
Copy link
Collaborator Author

niteskum commented Jun 21, 2018

@nethip In setupAutoUpdate() function initNode() and initState() function were called one after another. So there were no synchronization between setUpdateInProgressState() and CheckUpdateStatus()
InitNode Function notifies Brackets to reset inProgress Flag when Bracket is launched. and initState() function used to call checkUpdateFunction() which cleans up Update Temp Folder If Update was initiated in prev session. sometime UpdateTemp were being cleaned up before setting up the flags. and Exception were thrown in setUpdateInProgress() function because there was no File to write.

Changes in this PR:
Renamed the function "setAutoUpdateInProgressFlag" to "nodeDomainInitialized". and from initNode Function Node Notifies to Brackets to execute "nodeDomainInitialized" function and pass a parameter "reset" which is true If Brackets is launched. and false If New Brackets Window is opened.
and in nodeDomainInitialized function , initState() Function is called . and resetting of "InProgress"Flag and checkUpdateStatus() are executed in sequence.
so this makes sure There is No RaceCondtion between resetting the flag and cleaning up the temp folder.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants