jenkinsci / pipeline-agent-build-history-plugin

Agent Build History with pipeline jobs for Jenkins
https://plugins.jenkins.io/pipeline-agent-build-history/
MIT License
2 stars 2 forks source link

rework history loading to avoid hanging Jenkins #24

Closed mawinter69 closed 3 months ago

mawinter69 commented 4 months ago

On Jenkins instances with many jobs and runs the history loading seems to cause hanging jobs. I could see pipeline jobs finished but the executor on the agent they run on was still in use. A possible cause might be that the complete history was loaded whenever an agent was used the first time. As loading looped over all runs this unnecessarily made it loop over all runs several times (which can be quite time consuming on a Jenkins with > 150 agents and > 50000 runs). This is now avoided and history is only loaded the very first time an extended history page is opened. Though this means that the history will only contain those runs that started running on an executor since Jenkins started. But from that point on the history should be complete. Additionally for each run only one object is created so memory footprint should be lower. There might be corner cases where history is missing (e.g. an agent is deleted and then recreated).

Testing done

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue