Skip to content

Conversation

@fmdl
Copy link
Contributor

@fmdl fmdl commented Aug 12, 2025

Before this commit a search in large database can crash, because the return of search() can include million of ids.

This PR use SQL (and not python).
A limit can be set to prevent a crash.

Before this commit a search in large database can crash, because the return of search() can include million of ids.

This PR use SQL (and not python).
A limit can be set to prevent a crash.
@OCA-git-bot
Copy link
Contributor

Hi @AungKoKoLin1997, @yostashiro,
some modules you are maintaining are being modified, check this out!

@fmdl
Copy link
Contributor Author

fmdl commented Aug 12, 2025

@alexis-via

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

domain = expression.AND([[("model", "=", self._name)], word_domain])
messages = self.env["mail.message"].search(domain)
return [("id", "in", messages.mapped("res_id"))]
limit_value = self.env['ir.config_parameter'].sudo().get_param("mail.message.search.limit")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this may follow the convention better.

Suggested change
limit_value = self.env['ir.config_parameter'].sudo().get_param("mail.message.search.limit")
limit_value = self.env['ir.config_parameter'].sudo().get_param("mail_message_search.message_limit")

Can you please add the CONFIGURE file for this?

@AungKoKoLin1997
Copy link
Contributor

@fmdl Thanks for the fix. I backported this PR in my 17.0 migration PR and also added configuration file.
It’d be great if you could include the configuration file in your PR. Please also fix the pre-commit error.

@AungKoKoLin1997
Copy link
Contributor

Forgot to attach the backported commit in my above commend.
OCA/social@6f374ca

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants