Size limit on notify-based cache clearing
Hello,
I am currently working on a feature where a single transaction happens to clear
a lot (something around the hundred mark) caches at once.
When running a channel-based cache, this leads to a failure when committing the
transaction, when the "Clear Cache" instruction is effectively send to the
running trytond instances:
psycopg2.errors.InvalidParameterValue: payload string too long
The problem is that all caches are invalidated using a single "NOTIFY" call,
even when, as is the case here, there are a lot of caches to clear.
A naïve solution would be to split this call so that the query's size does not
exceed this limit. It should be ok since the NOTIFY's will not be sent to other
workers until the transaction is actually committed in the database, so they
either will be all sent at once, or none of them will.