Description: On a database with heavy activity, it is possible for the payload size we pass for the `NOTIFY` query on the bus to be larger than what PostgreSQL allows by default, 8000 B. This limit is defined as: https://github.com/postgres/postgres/blob/6686e9676c8faff4ee04c1574e117ae38f117efa/src/backend/commands/async.c#L158-L166 and it is used to compare the size of the payload before processing: https://github.com/postgres/postgres/blob/6686e9676c8faff4ee04c1574e117ae38f117efa/src/backend/commands/async.c#L654-L657 Fix: - Binary split the payload into multiple chunks if it's exceeding the above-mentioned limit. The unit of splitting is a channel, so if the content of one channel itself is larger than said limit, it is not handled, but shouldn't occur under normal circumstances. - Introduce also a new ENV variable `ODOO_NOTIFY_PAYLOAD_MAX_LENGTH` to allow tweaking of the limit if they are running a handrolled custom PostgreSQL cluster. Reference: opw-3650618 closes odoo/odoo#159469 X-original-commit: 61c7bba44990522d853bae25aa7899cb03c72e31 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>