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