-
Improvement
-
Resolution: Unresolved
-
Minor
I have a java.util.concurrent.LinkedBlockingQueue<Step>() which holds every step for my build pipeline. I also have a variable count of workers that call a getWork() method to get one of those steps. getWork() looks like:
Step getWork() { if (Data.stepQueue.size() == 0) { return null } Step work try { timeout(time: 10, unit: 'SECONDS') { work = Data.stepQueue.take() } } catch (e) { echo "Pipeline Warning: Could not take new element of stepQueue. Worker may shut down now..." return null } if (!work.readyToRun) { Data.stepQueue.put(work) return getWork() } return work }
I put a timeout around the take() call, because there might not be enough work at the end. The issue is, that killing this takes much longer than it should.
I checked the source code and there is already a forcible attribute. It would be great to pass a value by calling timeout like this:
timeout(forcible: true, time: 10, unit: 'SECONDS') { data.take() }
Please add the possibility to enforce this.