Skip to content

The Gemini Cookbook example in FastAPI doesn't always trigger start_up() #420

Description

@Zundrium

I've started with a 1 to 1 copy of the cookbook example and ran the index.html

Sadly sometimes (1 out of 10 times) it runs and other times the start_up method of the GeminiHandler just doesn't run. If I understand correctly this is supposed to run on every new connection.

I've let Gemini search through all possible library files and it fixed it by overriding "set_args" like so:

    def set_args(self, args: list[Any]) -> None:
        print(f"[DEBUG] GeminiHandler: set_args called with {len(args)} args")
        super().set_args(args)
        
        if not self.channel_set.is_set():
            print("[DEBUG] GeminiHandler: Force-setting channel_set event to unblock start()")
            self.channel_set.set()

Instead of never initializing, now it does in around 3 to 5 seconds.

What is going on? Are the examples outdated?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions