Isn't it the way it works now? When a new PS gets pushed, the branch reindexing will remove the job of the old build, cancelling it if it's still active.
What is instead the behaviour that you observe upon the upload of a new patch-set?
Not from what I have seen, the project for the old patch set only gets marked as disabled on Jenkins, but the actual build keeps on going until its finished.
What I would like to see is the option to be able to make it stop completely (as if you would manually click the stop build button on Jenkins) when the new patchset is detected
Gotcha, it's a valid concern then. The new PS build is triggered, anyway, the old job would consume CPU without being able to report any valid feedback, as the PS is obsolete anyway.
It contains the function updateChildren which I believe is the one handling the disabling of old patch-sets in my case. An alternative to adding something to the gerrit plugin could be if that plugin had the option to also stop jobs when it does the disabling. At least that would be sufficient for my use-case.
Yes, I did a bit of research and I came to the same conclusion: this is something for the computed-folder-plugin rather than the gerrit-code-review plugin.
It should be reported and resolved there, as the strategy for stopping the job when it becomes orphan should be done in that class.