Add a refresh:false when deleting action_task_params (#144399)

* Add a refresh:false when deleting action_task_params

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Mike Côté 2022-11-02 10:40:07 -04:00 committed by GitHub
parent c795facbe9
commit 2c909c18cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -304,7 +304,9 @@ test('cleans up action_task_params object', async () => {
await taskRunner.run();
expect(services.savedObjectsClient.delete).toHaveBeenCalledWith('action_task_params', '3');
expect(services.savedObjectsClient.delete).toHaveBeenCalledWith('action_task_params', '3', {
refresh: false,
});
});
test('task runner should implement CancellableTask cancel method with logging warning message', async () => {
@ -367,7 +369,9 @@ test('runs successfully when cleanup fails and logs the error', async () => {
await taskRunner.run();
expect(services.savedObjectsClient.delete).toHaveBeenCalledWith('action_task_params', '3');
expect(services.savedObjectsClient.delete).toHaveBeenCalledWith('action_task_params', '3', {
refresh: false,
});
expect(taskRunnerFactoryInitializerParams.logger.error).toHaveBeenCalledWith(
'Failed to cleanup action_task_params object [id="3"]: Fail'
);

View file

@ -171,7 +171,8 @@ export class TaskRunnerFactory {
// Once support for legacy alert RBAC is dropped, this can be secured
await getUnsecuredSavedObjectsClient(request).delete(
ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE,
actionTaskExecutorParams.actionTaskParamsId
actionTaskExecutorParams.actionTaskParamsId,
{ refresh: false }
);
} catch (e) {
// Log error only, we shouldn't fail the task because of an error here (if ever there's retry logic)