Skip to content

Commit

Permalink
perf(server): open db connection on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
nritsche committed Sep 25, 2020
1 parent 0642c75 commit 4e648c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bondia/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
import logging
import panel as pn

from chimedb.core import connect as chimedbconnect

from .data import DataLoader
from .util.exception import ConfigError
from .gui import BondiaGui

logger = logging.getLogger(__name__)

# Open DB connection
chimedbconnect(reconnect=True)


class BondiaServer(Reader):
logging = logging_config(default={"root": "INFO"})
Expand Down
2 changes: 0 additions & 2 deletions bondia/util/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import List

from chimedb import dataflag as df
from chimedb.core import connect as chimedbconnect

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -66,7 +65,6 @@ def get_one_flag_type(flag_type: str):
List[Tuple[str, float, float]]
List of flags: type name with start and end time.
"""
chimedbconnect()
flags = (
df.DataFlag.select()
.join(df.DataFlagType)
Expand Down

0 comments on commit 4e648c6

Please sign in to comment.