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

[FIX] auth_session_timeout: add /longpolling/im_status as ignored url #689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth_session_timeout/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"maintainer": "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-auth",
"category": "Tools",
"version": "15.0.1.0.0",
"version": "15.0.1.0.1",
"license": "AGPL-3",
"data": ["data/ir_config_parameter_data.xml"],
"installable": True,
Expand Down
4 changes: 3 additions & 1 deletion auth_session_timeout/data/ir_config_parameter_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
</record>
<record id="inactive_session_time_out_ignored_url" model="ir.config_parameter">
<field name="key">inactive_session_time_out_ignored_url</field>
<field name="value">/calendar/notify,/longpolling/poll</field>
<field
name="value"
>/calendar/notify,/longpolling/poll,/longpolling/im_status</field>
</record>
</odoo>
28 changes: 28 additions & 0 deletions auth_session_timeout/migrations/15.0.1.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)


def migrate(cr, version):
add_controller_to_parameter(cr)


def add_controller_to_parameter(cr):
"""Add /longpolling/im_status because it is executed several times (every 50 seconds)"""
env = api.Environment(cr, SUPERUSER_ID, {})
new_url = "/longpolling/im_status"
ignored_path_key = "inactive_session_time_out_ignored_url"
param = env["ir.config_parameter"]
old_value = param.get_param(ignored_path_key, "")
if new_url in old_value:
_logger.info(
"%s is included in the parameter %s already.", new_url, ignored_path_key
)
return
new_value = "%s,%s" % (old_value, new_url)
param.set_param(ignored_path_key, new_value)
_logger.info(
"%s was added to the parameter %s successfully.", new_url, ignored_path_key
)
Loading