Skip to content

Commit a41fab8

Browse files
authored
[BUG] validate nofile limit in case of empty string (chroma-core#1346)
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Fixes an issue where the empty string was not being handled by pydantic validation. Here we treat the empty string as None. - New functionality - ... ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js ## Documentation Changes None
1 parent ccfa914 commit a41fab8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

chromadb/config.py

+7
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ class Settings(BaseSettings): # type: ignore
124124
chroma_server_grpc_port: Optional[str] = None
125125
# eg ["http://localhost:3000"]
126126
chroma_server_cors_allow_origins: List[str] = []
127+
128+
@validator("chroma_server_nofile", pre=True, always=True, allow_reuse=True)
129+
def empty_str_to_none(cls, v: str) -> Optional[str]:
130+
if type(v) is str and v.strip() == "":
131+
return None
132+
return v
133+
127134
chroma_server_nofile: Optional[int] = None
128135

129136
pulsar_broker_url: Optional[str] = None

0 commit comments

Comments
 (0)