Spaces:
Running
Running
Update config_provider.py
Browse files- config_provider.py +3 -7
config_provider.py
CHANGED
@@ -155,11 +155,7 @@ class ConfigProvider:
|
|
155 |
|
156 |
# Check for race condition
|
157 |
if config.last_update_date and current_config.last_update_date:
|
158 |
-
|
159 |
-
expected_normalized = cls._normalize_date(config.last_update_date)
|
160 |
-
actual_normalized = cls.normalize_date(current_config.last_update_date)
|
161 |
-
|
162 |
-
if expected_normalized != actual_normalized:
|
163 |
raise RaceConditionError(
|
164 |
"Configuration was modified by another user",
|
165 |
current_user=username,
|
@@ -172,8 +168,8 @@ class ConfigProvider:
|
|
172 |
config.last_update_date = get_current_timestamp()
|
173 |
config.last_update_user = username
|
174 |
|
175 |
-
# Convert to JSON
|
176 |
-
data = config.
|
177 |
json_str = json.dumps(data, ensure_ascii=False, indent=2)
|
178 |
|
179 |
# Atomic write using temp file
|
|
|
155 |
|
156 |
# Check for race condition
|
157 |
if config.last_update_date and current_config.last_update_date:
|
158 |
+
if not timestamps_equal(config.last_update_date, current_config.last_update_date):
|
|
|
|
|
|
|
|
|
159 |
raise RaceConditionError(
|
160 |
"Configuration was modified by another user",
|
161 |
current_user=username,
|
|
|
168 |
config.last_update_date = get_current_timestamp()
|
169 |
config.last_update_user = username
|
170 |
|
171 |
+
# Convert to JSON - Pydantic v2 kullanımı
|
172 |
+
data = config.model_dump(mode='json') # to_jsonc_dict yerine model_dump
|
173 |
json_str = json.dumps(data, ensure_ascii=False, indent=2)
|
174 |
|
175 |
# Atomic write using temp file
|