You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The is_verified fetch all members of the community, with a DB query.
This leads to 2 issues:
if a request like /api/communities, multiple DB query are performed
it looks like that cls(obj.data, model=obj) in get_members, used by the system fields, triggers an UPDATE query:
File "/usr/local/lib/python3.9/site-packages/invenio_communities/communities/records/systemfields/is_verified.py", line 25, in calculate
owners = [m.dumps() for m in Member.get_members(record.id) if m.role == "owner"]
File "/usr/local/lib/python3.9/site-packages/invenio_communities/members/records/api.py", line 153, in get_members
return [cls(obj.data, model=obj) for obj in q.all()]
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/query.py", line 2773, in all
return self._iter().all()
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
result = self.session.execute(
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/session.py", line 1665, in execute
) = compile_state_cls.orm_pre_session_exec(
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/context.py", line 312, in orm_pre_session_exec
session._autoflush()
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/session.py", line 2253, in _autoflush
self.flush()
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
self._flush(objects)
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
flush_context.execute()
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
rec.execute(self)
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
util.preloaded.orm_persistence.save_obj(
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 237, in save_obj
_emit_update_statements(
File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 975, in _emit_update_statements
The is_verified fetch all members of the community, with a DB query.
This leads to 2 issues:
/api/communities
, multiple DB query are performedget_members
, used by the system fields, triggers an UPDATE query:Related fixes:
The text was updated successfully, but these errors were encountered: