8000 Idempotent start of the DynamoDB server (#11815) · localstack/localstack@ab64e0f · GitHub
[go: up one dir, main page]

Skip to content

Commit ab64e0f

Browse files
authored
Idempotent start of the DynamoDB server (#11815)
1 parent f020c22 commit ab64e0f

File tree

1 file changed

+5
-0
lines changed
  • localstack-core/localstack/services/dynamodb

1 file changed

+5
-0
lines changed

localstack-core/localstack/services/dynamodb/server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ def __init__(
7676
def get() -> "DynamodbServer":
7777
return DynamodbServer(config.DYNAMODB_LOCAL_PORT)
7878

79+
@synchronized(lock=RESTART_LOCK)
7980
def start_dynamodb(self) -> bool:
8081
"""Start the DynamoDB server."""
8182

83+
# We want this method to be idempotent.
84+
if self.is_running() and self.is_up():
85+
return True
86+
8287
# For the v2 provider, the DynamodbServer has been made a singleton. Yet, the Server abstraction is modelled
8388
# after threading.Thread, where Start -> Stop -> Start is not allowed. This flow happens during state resets.
8489
# The following is a workaround that permits this flow

0 commit comments

Comments
 (0)
0