Skip to content

Commit

Permalink
[JENKINS-64356] call onCreatedFromScratch after creating item via api…
Browse files Browse the repository at this point in the history
… or cli

When creating jobs via the rest api or cli the call to
onCreatedFromScratch was missing. This can lead to long startup times
when many jobs are created this way.
  • Loading branch information
mawinter69 committed May 23, 2024
1 parent 5dfdc5f commit adec0da
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/ItemGroupMixIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public synchronized TopLevelItem createProjectFromXML(String name, InputStream x

add(result);

result.onCreatedFromScratch();
ItemListener.fireOnCreated(result);
Jenkins.get().rebuildDependencyGraphAsync();

Expand Down
2 changes: 0 additions & 2 deletions test/src/test/java/jenkins/model/RunIdMigratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void legacyIdsPresent() throws Exception {
assertTrue(legacyIds.exists());
}

@Ignore("TODO Item#onCreatedFromScratch is not called")
@Issue("JENKINS-64356")
@Test
public void legacyIdsPresentViaRestApi() throws Exception {
Expand All @@ -82,7 +81,6 @@ public void legacyIdsPresentViaRestApi() throws Exception {
assertTrue(legacyIds.exists());
}

@Ignore("TODO Item#onCreatedFromScratch is not called")
@Issue("JENKINS-64356")
@Test
public void legacyIdsPresentViaCli() {
Expand Down

0 comments on commit adec0da

Please sign in to comment.