mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
Removing unnecessary flush.
This commit is contained in:
parent
3d7d5c7858
commit
a322d1a0a9
3 changed files with 5 additions and 4 deletions
|
|
@ -382,7 +382,7 @@ def save_channels_config(session=None, preserve_favorites: bool = True):
|
|||
def import_channels_config():
|
||||
"""Import channel settings to the DB. Existing channels will be updated."""
|
||||
if PYTEST and not TEST_CHANNELS_CONFIG:
|
||||
logger.warning(f'Not importing channels during this test. Use `test_channels_config` fixture if you would'
|
||||
logger.warning(f'Not importing channels during this test. Use `test_channels_config` fixture if you would '
|
||||
f'like to call this.')
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -805,8 +805,10 @@ def register_modeler(modeler: callable):
|
|||
|
||||
|
||||
def apply_modelers(files, session: Session):
|
||||
from wrolpi.files.lib import split_path_stem_and_suffix, get_mimetype
|
||||
from wrolpi.files.models import File
|
||||
"""
|
||||
Group Files by stem, send those groups to the modelers. Each modeler will model what Files are valid.
|
||||
"""
|
||||
from wrolpi.files.lib import split_path_stem_and_suffix
|
||||
|
||||
if not files:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@ async def _refresh_files_list(paths: List[pathlib.Path], idempotency: datetime.d
|
|||
if new_paths := (chunk - existing_paths):
|
||||
new_files = [File(path=i, idempotency=idempotency, mimetype=get_mimetype(i)) for i in new_paths]
|
||||
session.add_all(new_files)
|
||||
session.flush(new_files)
|
||||
# Apply models to all files. Many files will have no model.
|
||||
all_files = existing_files + new_files
|
||||
apply_modelers(all_files, session)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue