mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-11 00:02:37 +02:00
Fix collection existence test logic (#597)
This commit is contained in:
parent
fe2dd704a2
commit
7a5bf47959
1 changed files with 7 additions and 2 deletions
|
|
@ -109,11 +109,16 @@ class CollectionManager:
|
||||||
|
|
||||||
response = await self.send_config_request(request)
|
response = await self.send_config_request(request)
|
||||||
|
|
||||||
# If collection exists, we're done
|
# Validate response
|
||||||
if response.values and len(response.values) > 0:
|
if not response.values or len(response.values) == 0:
|
||||||
|
raise Exception(f"Invalid response from config service when checking collection {user}/{collection}")
|
||||||
|
|
||||||
|
# Check if collection exists (value not None means it exists)
|
||||||
|
if response.values[0].value is not None:
|
||||||
logger.debug(f"Collection {user}/{collection} already exists")
|
logger.debug(f"Collection {user}/{collection} already exists")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Collection doesn't exist (value is None), proceed to create
|
||||||
# Create new collection with default metadata
|
# Create new collection with default metadata
|
||||||
logger.info(f"Auto-creating collection {user}/{collection}")
|
logger.info(f"Auto-creating collection {user}/{collection}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue