Skip to content

Commit a696373

Browse files
committed
rewrite server with asyncio
Summary: Rewrite the server to use asyncio and be multithreaded. Allows handling multiple clients. Test Plan: Tests updated. Later test also tests multiple db writes simultaneously.
1 parent 396fbaa commit a696373

File tree

14 files changed

+458
-434
lines changed

14 files changed

+458
-434
lines changed

aepsych/database/db.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# LICENSE file in the root directory of this source tree.
77

88
import datetime
9+
import io
910
import json
1011
import logging
1112
import os
@@ -440,12 +441,14 @@ def record_outcome(
440441
self._session.add(outcome_entry)
441442
self._session.commit()
442443

443-
def record_strat(self, master_table: tables.DBMasterTable, strat: Strategy) -> None:
444+
def record_strat(
445+
self, master_table: tables.DBMasterTable, strat: io.BytesIO
446+
) -> None:
444447
"""Record a strategy in the database.
445448
446449
Args:
447450
master_table (tables.DBMasterTable): The master table.
448-
strat (Strategy): The strategy.
451+
strat (BytesIO): The strategy in buffer form.
449452
"""
450453
strat_entry = tables.DbStratTable()
451454
strat_entry.strat = strat

0 commit comments

Comments
 (0)