https://authzed.com logo
i m using spiceDB in python flask app to
y

youling66

03/30/2023, 1:20 PM
i'm using spiceDB in python flask app to manage permission. and I'm using gunicorn to start my app with 20 workers. all gRPC API works fine except 'server_stream' type API such as LookupSubjects, the code just blocked where `client.LookupSubjects(req)`are
...
user_list = []
# 流式调用
print(f"hello~ client={client}") # stuck here
for resp in client.LookupSubjects(request=req):
    print(f"tsktsk {resp}")      # this never ouput when API called in flask view functions
    resp: LookupSubjectsResponse
    if resp.subject.permissionship == LookupPermissionship.LOOKUP_PERMISSIONSHIP_HAS_PERMISSION.value:
        user_list.append(resp.subject.subject_object_id)
logging.info("users have [%s] role/permission towards [%s:%s] are %s", permission.value,
             resource_type.value, resource_id, user_list)
but when w
v

vroldanbet

03/30/2023, 1:59 PM
👋🏻 please have a look at our tests on how to use that API method: https://github.com/authzed/authzed-py/blob/main/tests/v1_test.py#L145-L163
y

youling66

03/31/2023, 1:58 AM
yeah, i did like that. and it worked well while i'm directly call lookupSubjects() API in my test case. but if I add this to my flask app which is run by gunicorn as i mentioned before. it just stuck where the api called.
v

vroldanbet

03/31/2023, 11:07 AM
so you say that it works on a plain old python app, but when you use the gunicorn server it wont work?
@youling66 did you figure it out? otherwise please open an issue in the https://github.com/authzed/authzed-py repository with a description on how to reproduce the problem, ideally with a test case