Commit b665bd5
authored
[Fleet] Refactor abortController usage in Fleet task (#232814)
## Summary
Closes #216804
Most of Fleet tasks were fixed in
#230017
Tested locally by calling `abortController.abort()` to the first task
run, and then verifying that the task still runs next time.
```
[2025-08-26T09:56:08.158+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] started
[2025-08-26T09:56:08.158+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] abort task
[2025-08-26T09:56:08.361+02:00][ERROR][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] error: Error: Task was aborted
[2025-08-26T09:56:08.361+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] runTask ended: error
[2025-08-26T09:56:21.114+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] started
[2025-08-26T09:56:21.296+02:00][DEBUG][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] Recording 10000 status changes
[2025-08-26T09:56:24.215+02:00][DEBUG][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] Recording 10000 status changes
[2025-08-26T09:56:26.294+02:00][DEBUG][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] Recording 10000 status changes
[2025-08-26T09:56:28.357+02:00][DEBUG][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] Recording 10000 status changes
[2025-08-26T09:56:30.367+02:00][DEBUG][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] Recording 10000 status changes
[2025-08-26T09:56:32.404+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] runTask ended: success
[2025-08-26T09:56:33.109+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] started
[2025-08-26T09:56:33.481+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] runTask ended: success
[2025-08-26T09:56:45.117+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] started
[2025-08-26T09:56:45.496+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] runTask ended: success
[2025-08-26T09:56:54.120+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [runTask()] started
[2025-08-26T09:56:54.508+02:00][INFO ][plugins.fleet.fleet:agent-status-change-task:1.0.3] [AgentStatusChangeTask] runTask ended: success
```
### Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
### Identify risks
Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.
- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...1 parent 4574388 commit b665bd5
File tree
1 file changed
+21
-14
lines changed1 file changed
+21
-14
lines changedLines changed: 21 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 81 | + | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
121 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
147 | | - | |
| 153 | + | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| |||
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | | - | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
179 | | - | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
262 | 269 | | |
263 | 270 | | |
264 | 271 | | |
265 | | - | |
266 | | - | |
| 272 | + | |
| 273 | + | |
267 | 274 | | |
268 | 275 | | |
269 | 276 | | |
| |||
0 commit comments