Skip to content

Commit 059c693

Browse files
committed
Fix: thread-safe middleware singleton and re-enable repo stats schedule
1 parent ecf6cde commit 059c693

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.github/workflows/github-repo-stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: github-repo-stats
22

33
on:
4-
# schedule:
4+
schedule:
55
# Run this once per day, towards the end of the day for keeping the most
66
# recent data point most meaningful (hours are interpreted in UTC).
7-
#- cron: "0 23 * * *"
7+
- cron: "0 23 * * *"
88
workflow_dispatch: # Allow for running this manually.
99

1010
jobs:

Server/src/transport/unity_instance_middleware.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
# Store a global reference to the middleware instance so tools can interact
1717
# with it to set or clear the active unity instance.
1818
_unity_instance_middleware = None
19+
_middleware_lock = RLock()
1920

2021

2122
def get_unity_instance_middleware() -> 'UnityInstanceMiddleware':
2223
"""Get the global Unity instance middleware."""
2324
global _unity_instance_middleware
2425
if _unity_instance_middleware is None:
25-
# Auto-initialize if not set (lazy singleton) to handle import order or test cases
26-
_unity_instance_middleware = UnityInstanceMiddleware()
26+
with _middleware_lock:
27+
if _unity_instance_middleware is None:
28+
# Auto-initialize if not set (lazy singleton) to handle import order or test cases
29+
_unity_instance_middleware = UnityInstanceMiddleware()
2730

2831
return _unity_instance_middleware
2932

0 commit comments

Comments
 (0)