Skip to content

Commit

Permalink
use sqlitequeuedb
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Jan 24, 2021
1 parent 0c0e141 commit 714d768
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frigate/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import yaml
from peewee_migrate import Router
from playhouse.sqlite_ext import SqliteExtDatabase
from playhouse.sqliteq import SqliteQueueDatabase

from frigate.config import FrigateConfig
from frigate.const import RECORD_DIR, CLIPS_DIR, CACHE_DIR
Expand Down Expand Up @@ -117,13 +118,16 @@ def init_queues(self):
self.detected_frames_queue = mp.Queue(maxsize=len(self.config.cameras.keys())*2)

def init_database(self):
self.db = SqliteExtDatabase(self.config.database.path)
migrate_db = SqliteExtDatabase(self.config.database.path)

# Run migrations
del(logging.getLogger('peewee_migrate').handlers[:])
router = Router(self.db)
router = Router(migrate_db)
router.run()

migrate_db.close()

self.db = SqliteQueueDatabase(self.config.database.path)
models = [Event]
self.db.bind(models)

Expand Down

0 comments on commit 714d768

Please sign in to comment.