-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
reload: Recurse into packaged modules #1314
Conversation
Force-reload all sub-modules of packages recursively. See #1056.
Thanks, I will have a look soon. This should make working on those packaged modules a lot easier. |
Every @sopel.module.rule needs to have an associated @sopel.module.priority decorator or the reload will fail:
Once that is fixed, there are still problems with reloading the https://github.com/sopel-irc/sopel-youtube module which locks up the bot. |
@kwaaak Is the problem with reloading sopel-youtube specific to this PR (caused by the changes)? If not, it belongs in a separate issue. Is there no error associated with loading the module as well? Lines 232 to 233 in 253fd9b
|
Follow-on to #1056 (comment) but keeping it here as it relates to this PR directly: As previously tested, updated methods work great. Adding new methods works as expected, too. Removing methods, though, causes issues. Sopel will repeat a removed command (1 + number_of_module_reloads_since_removal) times, instead of removing it. At present, that's still better than #1053, which added 4 repetitions of the removed test command after a single reload. But neither solution is perfect, yet. I have some poking around to do, once more. (This might get merged with the removed-method problem unfixed if I can't find it shortly. Fixing that isn't worth holding up the rest of the patch. Can't let perfect be the enemy of good, especially since fixing the issue with removed methods is a diminishing-returns prospect: high complexity, low incidence.) |
This is pulling in #1314 via |
@RustyBower I was really confused by that log until I tested again myself. The non-standard W|A output is a remnant of the last time I played with this, I think. This is after checking out a new
You can see where I realized that I had only tested reloading a specific module. 😸 So, it looks like this PR is an improvement, as I thought, but fails to handle the "reload all" case. (The existing code calling I'm going to play with it some more, because if I can fix that in the next day or two I would love to pull this back into 6.6.0. Got an idea to start with, so here goes nothing. |
Update: My idea worked! I half expected it to break something, but it seems to work fine. @RustyBower could you test the update? (And @HumorBaby, since I see your comments in the other thread? :P) |
Did some nefarious testing as mentioned in #sopel. Works as expected 😄 |
Force-reload all sub-modules of packages recursively.
I dare say this actually fixes (most of) #1056 after two years. My testing on Python 3.6 has been promising so far, and I've heard good things from @ralienpp in that thread about its effects under Python 2.7.
My fingers remain crossed. But someone else should definitely look at this before it gets merged to make sure I didn't do something dumb. I played with the logic a lot yesterday, and after all those little tweaks I'm kind of fuzzy on what I actually did. 🤣
(Also, note to self: Find that StackOverflow post again and amend the commit to reference it in a code comment somewhere before merging.)