Skip to content

Commit

Permalink
Prevent module caching in Python parser to fix state reloading
Browse files Browse the repository at this point in the history
(see #61)
  • Loading branch information
pschillinger committed Apr 26, 2020
1 parent c69ccc0 commit aa61ea9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/io/io_packageparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ IO.PackageParser = new (function() {
if (state_def != undefined) {
state_def.setFilePath(entry);
WS.Statelib.updateDef(state_def);
T.logInfo("Updating changed definition for state: " + state_def.getStateClass());
T.logInfo("Updating changed definition for state: " + state_def.getStateType());
var update_states = Behavior.getStatemachine().traverseStates(function(state) {
return state.getStateClass() == state_def.getStateClass();
return state.getStateType() == state_def.getStateType();
});
update_states.forEach(function (state) {
state.updateStateDefinition(state_def);
Expand Down
1 change: 1 addition & 0 deletions src/io/io_stateparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ for data in iter(sys.stdin.readline, ""):
result = {'id': request['id'], 'state_defs': state_defs}
try:
pkg = __import__(request['import_path'], fromlist=[request['import_path']])
del sys.modules[pkg.__name__] # prevent module caching (to allow state reloading)
def is_state(member):
return (inspect.isclass(member) and
member.__module__ == pkg.__name__ and
Expand Down

0 comments on commit aa61ea9

Please sign in to comment.