Skip to content

Commit 80e348f

Browse files
authored
Merge pull request #166 from openstates/update-logs
Change recent commit check to 6 hours
2 parents ee86717 + 53aec3a commit 80e348f

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 6.21.2 - Mar 3, 2025
4+
5+
* Catch Django Settings already configures exception
6+
37
## 6.21.1 - Mar 1, 2025
48

59
* Update people repo cli usage

openstates/cli/people_repo_update.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def no_recent_people_repo_commit() -> bool:
2828
last_commit_time = datetime.datetime.fromisoformat(
2929
last_commit_time.rstrip("Z")
3030
).replace(tzinfo=datetime.timezone.utc)
31-
two_hours_ago = datetime.datetime.now(
31+
six_hours_ago = datetime.datetime.now(
3232
datetime.timezone.utc
3333
) - datetime.timedelta(
34-
minutes=2 * 60 + 5
35-
) # 2 hours and 5-minute buffer.
36-
no_recent_commit_exists = two_hours_ago > last_commit_time
34+
minutes=6 * 60 + 5
35+
) # 6 hours and 5-minute buffer.
36+
no_recent_commit_exists = six_hours_ago > last_commit_time
3737
return no_recent_commit_exists
3838

3939

openstates/utils/django.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ def init_django() -> None: # pragma: no cover
1515
else:
1616
DATABASES["default"]["OPTIONS"]["application_name"] = application_name
1717

18-
conf.settings.configure(
19-
conf.global_settings,
20-
SECRET_KEY="not-important",
21-
DEBUG=False,
22-
INSTALLED_APPS=(
23-
"django.contrib.contenttypes",
24-
"openstates.data",
25-
),
26-
DATABASES=DATABASES,
27-
TIME_ZONE="UTC",
28-
MIDDLEWARE_CLASSES=(),
29-
)
30-
django.setup()
18+
try:
19+
conf.settings.configure(
20+
conf.global_settings,
21+
SECRET_KEY="not-important",
22+
DEBUG=False,
23+
INSTALLED_APPS=(
24+
"django.contrib.contenttypes",
25+
"openstates.data",
26+
),
27+
DATABASES=DATABASES,
28+
TIME_ZONE="UTC",
29+
MIDDLEWARE_CLASSES=(),
30+
)
31+
django.setup()
32+
except RuntimeError as e:
33+
if "Settings already configured." not in str(e):
34+
raise RuntimeError(f"Encountered error {e}")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "openstates"
3-
version = "6.21.1"
3+
version = "6.21.2"
44
description = "core infrastructure for the openstates project"
55
authors = ["James Turk <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)