]> git.proxmox.com Git - pmg-api.git/commit
rulecache: sort rules additionally by id
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 20 Dec 2022 10:57:35 +0000 (11:57 +0100)
committerDominik Csapak <d.csapak@proxmox.com>
Fri, 23 Dec 2022 12:18:14 +0000 (13:18 +0100)
commitf6b69037369e0ef77fd2eddb25e2c133b727bdab
tree2c7a692b6870c78bc57839f91aa59ad9c4a968f9
parent8d7a67b321a502e8aa1d1935bab333dc784fbe30
rulecache: sort rules additionally by id

When more rules have the same priority currently their order is not
stable - postgres returns them in a stable way, based on their last
changetime - e.g. disabling and reenabling a rule puts it in the front
of evaluation. Sortin by id (the primary key) in addition should make
rule evaluation robust to such updates

While there is no guarantee of ordering (within the same priority)
unexpected changes in which rule fires can cause confusion (at least
it confused me quite a bit).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/RuleCache.pm