Skip to content

Commit da7b10b

Browse files
eimrekml-evs
authored andcommitted
skip data inject if data already exists
1 parent 73d5242 commit da7b10b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

optimade/server/create_app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ def insert_main_data(
6262
):
6363
from optimade.utils import insert_from_jsonl
6464

65+
for coll_type in ["links", "structures", "references"]:
66+
if len(entry_collections[coll_type]) > 0:
67+
LOGGER.info("Skipping data insert: data already present.")
68+
return
69+
6570
def _insert_test_data(endpoint: str | None = None):
6671
import bson.json_util
6772
from bson.objectid import ObjectId
@@ -133,7 +138,7 @@ def insert_index_data(
133138
links_coll = entry_collections["links"]
134139

135140
if len(links_coll) > 0:
136-
LOGGER.info("Skipping index links inserct: links collection already populated.")
141+
LOGGER.info("Skipping index links insert: links collection already populated.")
137142
return
138143

139144
LOGGER.debug("Loading index links...")

0 commit comments

Comments
 (0)