Skip to content

Commit

Permalink
Merge pull request #299 from alex-dixon/pg-studio-fix
Browse files Browse the repository at this point in the history
fix: skip db watcher when postgres
  • Loading branch information
MadcowD authored Oct 11, 2024
2 parents 1b3a6c2 + 70d6a5e commit af086ad
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ell/studio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ def main():
if args.dev:
assert args.port == 5555, "Port must be 5000 in development mode"

if not args.storage_dir:
logger.warning("WARNING: Using current directory as the storage dir, pass --storage-dir to change this.")

config = Config.create(storage_dir=args.storage_dir,
pg_connection_string=args.pg_connection_string)
app = create_app(config)
Expand All @@ -69,7 +66,7 @@ async def serve_react_app(full_path: str):
return FileResponse(static_dir / "index.html")

# Respect Config.create behavior, which has fallback to env vars.
db_path = Path(config.storage_dir)
db_path = Path(config.storage_dir) if config.storage_dir else None

async def db_watcher(db_path, app):
last_stat = None
Expand Down Expand Up @@ -126,7 +123,8 @@ async def open_browser(host, port):
config = uvicorn.Config(app=app, host=args.host, port=args.port, loop=loop)
server = uvicorn.Server(config)
loop.create_task(server.serve())
loop.create_task(db_watcher(db_path, app))
if db_path:
loop.create_task(db_watcher(db_path, app))
if args.open:
loop.create_task(open_browser(args.host, args.port))
loop.run_forever()
Expand Down

0 comments on commit af086ad

Please sign in to comment.