mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-09 13:17:55 -05:00
Fix
This commit is contained in:
@@ -39,13 +39,7 @@ async def cleanup(ui: UIBase):
|
||||
|
||||
|
||||
def sync_cleanup(ui: UIBase):
|
||||
loop = None
|
||||
try:
|
||||
loop = asyncio.get_running_loop()
|
||||
except RuntimeError:
|
||||
asyncio.run(cleanup(ui))
|
||||
else:
|
||||
loop.create_task(cleanup(ui))
|
||||
asyncio.run(cleanup(ui))
|
||||
|
||||
|
||||
async def run_project(sm: StateManager, ui: UIBase, args) -> bool:
|
||||
@@ -319,11 +313,23 @@ async def async_main(
|
||||
|
||||
telemetry.start()
|
||||
|
||||
# Set up signal handlers
|
||||
def signal_handler(sig, frame):
|
||||
if not telemetry_sent:
|
||||
sync_cleanup(ui)
|
||||
sys.exit(0)
|
||||
try:
|
||||
loop = asyncio.get_running_loop()
|
||||
|
||||
def close_all():
|
||||
loop.stop()
|
||||
sys.exit(0)
|
||||
|
||||
if not telemetry_sent:
|
||||
cleanup_task = loop.create_task(cleanup(ui))
|
||||
cleanup_task.add_done_callback(close_all)
|
||||
else:
|
||||
close_all()
|
||||
except RuntimeError:
|
||||
if not telemetry_sent:
|
||||
sync_cleanup(ui)
|
||||
sys.exit(0)
|
||||
|
||||
for sig in (signal.SIGINT, signal.SIGTERM):
|
||||
signal.signal(sig, signal_handler)
|
||||
|
||||
3
main.py
3
main.py
@@ -2,6 +2,8 @@
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
||||
|
||||
try:
|
||||
import sentry_sdk
|
||||
|
||||
@@ -9,6 +11,7 @@ try:
|
||||
dsn="https://4101633bc5560bae67d6eab013ba9686@o4508731634221056.ingest.us.sentry.io/4508732401909760",
|
||||
send_default_pii=True,
|
||||
traces_sample_rate=1.0,
|
||||
integrations=[AsyncioIntegration()],
|
||||
)
|
||||
|
||||
sentry_sdk.profiler.start_profiler()
|
||||
|
||||
Reference in New Issue
Block a user