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

Persist REST state #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

pdmars
Copy link
Contributor

@pdmars pdmars commented Dec 13, 2016

No description provided.

Copy link
Member

@labisso labisso left a 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")
Copy link
Member

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)
Copy link
Member

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.

Base automatically changed from master to main March 20, 2021 17:08
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.

None yet

2 participants