Before this PR, disconnecting the websocket for a keep alive timeout would skip the terminate method. When the loop would exit, gevent loop will keep running and use the CPU up to 100%. This commit ensures the termiante method is called when disconnecting due to a keep alive timeout and solves this issue. closes odoo/odoo#99308 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>