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

auth functions create thread that prevents exit #451

Closed
RomanRobot opened this issue May 31, 2023 · 3 comments
Closed

auth functions create thread that prevents exit #451

RomanRobot opened this issue May 31, 2023 · 3 comments

Comments

@RomanRobot
Copy link

RomanRobot commented May 31, 2023

Describe the bug
After calling supabase.auth.set_session a thread named "Thread-6" gets created which prevents my program from exiting.

To Reproduce
Steps to reproduce the behavior:

  1. supabase = create_client
  2. supabase.auth.set_session
  3. Reach end of script - add a print at the bottom of the file
  4. Notice the debugger is still attached to the python script or the process is still running in Task Manager after reaching the end of the script

Expected behavior
The process ends.

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
I'm just using supabase 1.0.3 in a .py file on Windows 10 with Python 3.10.6. I saw supabase.auth has a close function. I saw that calls close on a variable called http_client. I was hoping that would stop the thread but it didn't seem to have an effect.

@NeoFoxxo
Copy link

NeoFoxxo commented Jun 8, 2023

use supabase.auth.sign_out() to close the program

@RomanRobot
Copy link
Author

That ended the thread. Thank you @NeoFoxxo!

@dericdesta
Copy link

The underlying problem here is, that there is by default a Timer-Thread refreshing the access token. This thread is stopped when you call supabase.auth.sign_out() as described above. You can also disable the timer by

supabase = create_client(
            supabase_url=...,
            supabase_key=...,
            options=ClientOptions(auto_refresh_token=False),
        )

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

No branches or pull requests

4 participants