Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove git locks when starting mycroft #1715

Merged
merged 1 commit into from
Aug 3, 2018
Merged

Conversation

MatthewScholefield
Copy link
Contributor

Description

This is a preventative measure to fix errors with git lock files not being removed when devices are unplugged or processes are killed

How to test

  • Make sure this doesn't cause a regression with downloading default skills

@MatthewScholefield MatthewScholefield added Type: Bug - complex CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) labels Aug 3, 2018
Copy link
Contributor

@penrods penrods left a comment

Choose a reason for hiding this comment

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

After the comment update, that'll be good to go!

for i in glob(join(self.msm.skills_dir, '*/.git/index.lock')):
LOG.warning('Found and removed git lock file: ' + i)
os.remove(i)

def run(self):
""" Load skills and update periodically from disk and internet """

# Load priority skills first, in order (very first time this will
# occur before MSM has run)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's clean this up -- the comment got left behind and makes absolutely no sense anymore. The code was originally this:

        # Load priority skills first, in order (very first time this will
        # occur before MSM has run)
        self.load_skill_list(PRIORITY_SKILLS)

So, that comment is no confusing, not helpful. Axe it.

Additionally, I think we need to explain the reasoning for the code that removes .git lock files. In the future, somebody is going to look at this and ask: "Why would someone do this? .git/index.lock is there for a reason!"

So add a comment that describes the reasoning behind the decision to override the locking mechanism.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

This is a preventative measure to fix errors with git lock files not being removed when devices are unplugged or processes are killed
@penrods penrods merged commit d49d991 into dev Aug 3, 2018
@penrods penrods deleted the bugfix/remove-git-locks branch August 3, 2018 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Type: Bug - complex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants