dify
dify copied to clipboard
fix recreating users' default tenaunt relations when loading user
- fix bugs in
load_user
introduced by #2341 -
- skip auto creating default tenant in this method. for the reasons that
- 1.1 it causes leak as it does not acquire locks to guarantee only one default tenant will be created
- 1.2 it's not a right timing to create user's default tenant. A better way is to do it in register service.
-
- reuse existed available tenant for the user
Caused by 1.2.
cc @crazywoola @takatost
We need to create a personal tenant as the owner when invited to another tenant. We need to make this logic before we can merge together.