-
Notifications
You must be signed in to change notification settings - Fork 72
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
Persist REST state #48
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall approach seems fine, aside from the comments/questions I added.
In general do you feel the existing tests are sufficient to cover these changes? I might be missing something, but I don't see any that create more than one blockade in a single deployment, so that seems like a gap.
""" | ||
|
||
@staticmethod | ||
def set_data_dir(data_dir): | ||
global DATA_DIR | ||
DATA_DIR = data_dir | ||
BASE_BLOCKADE_DIR = os.path.join(DATA_DIR, ".blockade") | ||
REST_STATE_FILE = os.path.join(BASE_BLOCKADE_DIR, "rest_state.yaml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to declare these two as global if the changes are to stick. However, is there a reason to use global vars at all? Perhaps all three of these vars could be on the class instead?
BLOCKADE_CONFIGS[name] = config | ||
rest_state = BlockadeManager.read_rest_state() | ||
rest_state[name] = config | ||
BlockadeManager.write_rest_state(rest_state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too familiar with Flask - are there multiple request handler threads? If so this behavior seems racy. Concurrent requests could step on each other. delete_config
too.
No description provided.