8000 DynamoDB: Fix hangup when resetting state by viren-nadkarni · Pull Request #11789 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content
10000

DynamoDB: Fix hangup when resetting state #11789

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

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions localstack-core/localstack/services/dynamodb/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def __init__(
self.db_path = None

if self.db_path:
mkdir(self.db_path)
self.db_path = os.path.abspath(self.db_path)

self.heap_size = config.DYNAMODB_HEAP_SIZE
Expand All @@ -80,12 +79,18 @@ def get() -> "DynamodbServer":
def start_dynamodb(self) -> bool:
"""Start the DynamoDB server."""

# For the v2 provider, the DynamodbServer has been made a singleton. Yet, the Server abstraction is modelled
# after threading.Thread, where Start -> Stop -> Start is not allowed. This flow happens during state resets.
# The following is a workaround that permits this flow
self._started.clear()
self._stopped.clear()

# Note: when starting the server, we had a flag for wiping the assets directory before the actual start.
# This behavior was needed in some particular cases:
# - pod load with some assets already lying in the asset folder
# - ...
# The cleaning is now done via the reset endpoint
self._stopped.clear()
mkdir(self.db_path)
started = self.start()
self.wait_for_dynamodb()
return started
Expand Down
Loading
0