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

Make the command for reloading code more robust #84

Merged
merged 1 commit into from
Apr 11, 2015
Merged

Make the command for reloading code more robust #84

merged 1 commit into from
Apr 11, 2015

Conversation

djr7C4
Copy link
Contributor

@djr7C4 djr7C4 commented Apr 11, 2015

I've been using this version of the reload_code() function and have found that it causes #77 to occur less frequently. Now it only occurs when I add a new grammar file in the MacroSystem directory. It always occurs when that happens however. I'm still not sure what causes that particular issue...

@calmofthestorm
Copy link
Member

Is it really safe to delete entries from sys.modules like that? I'm not entirely clear on what you're doing here or whether that part's necessary. Could you explain?

@djr7C4
Copy link
Contributor Author

djr7C4 commented Apr 11, 2015

This was in the old version already in Aenea as well.

It's necessary to ensure that all the modules get unloaded before natlink reloads them. Otherwise, if you have some file that isn't a grammar file, it won't get reloaded. This is what allows files inside Aenea itself to be reloaded for example.

@djr7C4
Copy link
Contributor Author

djr7C4 commented Apr 11, 2015

As for is it safe, I suspect that there is some module that refers to something that isn't getting reloaded so it still has the old (dead) reference. Either that, or it's something to do with the ordering.

@calmofthestorm
Copy link
Member

Fair enough. This is no worse than back when we didn't support any reload at all -- worst case is you have to restart Dragon.

calmofthestorm added a commit that referenced this pull request Apr 11, 2015
Make the command for reloading code more robust
@calmofthestorm calmofthestorm merged commit 5e82082 into dictation-toolbox:master Apr 11, 2015
@djr7C4
Copy link
Contributor Author

djr7C4 commented Apr 11, 2015

Incidentally, if you know a better way, it would be great to see it. Back when I developed this originally, I also tried several others which turned out to be even worse.

@calmofthestorm
Copy link
Member

afraid not. If I knew a better way, I'd have implemented it. I thought about trying trickery like this, but truth be told my opinion was (and is) that this setup is flaky enough without reload hackery. I'd rather just restart Dragon and know the issue I'm having isn't caused by reload hacks, even if it does lengthen the dev cycle a bit. I don't mind offering this command because it's strictly better than not having it.

@djr7C4 djr7C4 deleted the more-robust-reload branch April 11, 2015 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants