github-plugin icon indicating copy to clipboard operation
github-plugin copied to clipboard

Avoid eager Jenkins items lookup in the webhook cleaner.

Open duemir opened this issue 2 years ago • 6 comments

Use lazy iterable of all items instead of using an eager list of all the items that is stored in a local variable but immediately converted to the iterable.

I was looking through the heap dump in Eclipse MAT. Most of the memory was just taken by the WorkflowRun objects. It caught my attention that the Cleaner thread featured prominently in the Leak report. I looked into it and thought it could be improved a bit. Functionally nothing should change, the thread just no longer directly references all the items for the duration of execution.

I have also taken a chance to refactor the anonymous classes into lambdas in the functional utility class JobInfoHelpers.

  • [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
  • [x] Link to relevant pull requests, esp. upstream and downstream changes
  • [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue

duemir avatar Apr 07 '22 11:04 duemir

Bother! Two new SpotBug issues in the files that I didn't even touch 😢

duemir avatar Apr 08 '22 00:04 duemir

@Vlatombe do you know if maybe these two new unexpected SpotBug issues in NullSafeFunction and NullSafePredicate showed up because you changed the annotations recently?

duemir avatar May 05 '22 06:05 duemir

@duemir There are 19 spotbugs issues on master (same as in this PR), even before the annotations change. No idea how spotbugs think these are new.

Vlatombe avatar May 05 '22 11:05 Vlatombe

@KostyaSha maybe you have some ideas or comments?

duemir avatar May 06 '22 00:05 duemir

Bummer! Rebuild didn't help 😞

duemir avatar May 13 '22 00:05 duemir

Yey! SpotBug cleaned up after merging the latest master. @KostyaSha maybe you can merge it now.

duemir avatar Aug 19 '22 03:08 duemir

@lanwen @oleg-nenashev, maybe you can review and merge?

duemir avatar Jan 04 '23 06:01 duemir