Skip to content

Commit 938161b

Browse files
committed
feat(bus.bus): add index on bus_bus(channel, id) to optimize notifications
1 parent 80ed43d commit 938161b

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from . import bus_event_mixin
22
from . import ir_websocket
3+
from . import bus_bus
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from odoo import models
2+
from odoo.tools import index_exists
3+
4+
5+
class BusBus(models.Model):
6+
_inherit = "bus.bus"
7+
8+
def init(self):
9+
index_1 = "idx_bus_bus_channel_id"
10+
if not index_exists(self._cr, index_1):
11+
self._cr.execute(
12+
"CREATE INDEX idx_bus_bus_channel_id " "ON bus_bus (channel, id);"
13+
)

0 commit comments

Comments
 (0)