Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential panic in create_http_context #183

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

junr03
Copy link
Collaborator

@junr03 junr03 commented Oct 13, 2024

Signed-off-by: José Ulises Niño Rivera junr03@users.noreply.github.com

Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
@@ -282,7 +282,10 @@ impl RootContext for FilterContext {
// No StreamContext can be created until the Embedding Store is fully initialized.
let embedding_store = match self.mode {
GatewayMode::Llm => None,
GatewayMode::Prompt => Some(Rc::clone(self.embeddings_store.as_ref().unwrap())),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this unwrap can panic if a stream is being created before the embeddings store has finished initializing

@@ -282,7 +282,10 @@ impl RootContext for FilterContext {
// No StreamContext can be created until the Embedding Store is fully initialized.
let embedding_store = match self.mode {
GatewayMode::Llm => None,
GatewayMode::Prompt => Some(Rc::clone(self.embeddings_store.as_ref().unwrap())),
GatewayMode::Prompt => match self.embeddings_store.as_ref() {
None => return None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
None => return None,
None => None,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants