sirhamsteralot / HaE-PBLimiter

Profiles pb's and damages them when their runtime goes over a set value
MIT License
11 stars 5 forks source link

Players complain about empty PBs blowing up #20

Closed LordTylus closed 4 years ago

LordTylus commented 4 years ago

We limit PB Execution by Player on our server

configs are Avg PB MS = 0.3 Per player

For simplicity the examples below are assuming the limit is 0.5

So far the following behavior seems to be taking affect

PB 1 - 0.4 PB 2 - 0.1 PB 3 - 0.01 -> Over limit Break PB 1 PB 4 - 0.01 -> Over limit Break PB 1 PB 5 - 0.0 -> Over limit Break PB 1

which can also be observed in the logs https://cdn.discordapp.com/attachments/502549669855887360/688371289148358670/unknown.png

However this does not quite explain yet why seemingly innocent PBs also blow up.

If it were like PB 1 - 0.4 PB 2 - 0.1 PB 3 - 0.01 -> Over limit Break PB 1 PB 4 - 0.01 -> Over limit Break PB 2 PB 5 - 0.0 -> Over limit Break PB 3

It would make sense, why it breaks but only by static code anlysis it doesnt seem to be the case.

There are two ways I could think of to deal with it.

  1. Sorting the PBs before looping over them by runtime. Which would lead to such result:

PB 5 0.0 PB 4 0.01 PB 3 0.01 PB 2 0.1 PB 1 0.4 -> Over limit Break PB 1

Alternatively maybe looping by player and than by PB

PB 1 - 0.4 PB 2 - 0.1 PB 3 - 0.01 -> Over limit Break PB 1 -> break;

after PB 1 was damaged all other checks would just do the same. So stopping after the first one might be possible. When looping over everyone you cannot just break out of the loop

LordTylus commented 4 years ago

Just fixing the Method GetSlowestID to also factor in PBs that are enabled and functional would on its own lead to

PB 1 - 0.4 PB 2 - 0.1 PB 3 - 0.01 -> Over limit Break PB 1 PB 4 - 0.01 -> Over limit Break PB 2 PB 5 - 0.0 -> Over limit Break PB 3

and make it therefore worse. So there must be at least one other place altered.

azazar commented 4 years ago

I've noticed that bug on various servers. That's how it looks for player: pblimiter bug

azazar commented 4 years ago

I've made a pull request that should fix that: https://github.com/sirhamsteralot/HaE-PBLimiter/pull/23

sirhamsteralot commented 4 years ago

Released