Skip to content

Commit 1471453

Browse files
committed
Preserve context in snapshotDeletionListeners (elastic#84089)
Closes elastic#84036
1 parent ef8ab92 commit 1471453

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/changelog/84089.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 84089
2+
summary: Preserve context in `snapshotDeletionListeners`
3+
area: Snapshot/Restore
4+
type: bug
5+
issues:
6+
- 84036

server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,8 @@ private static boolean isWritingToRepository(SnapshotsInProgress.Entry entry) {
22862286
}
22872287

22882288
private void addDeleteListener(String deleteUUID, ActionListener<Void> listener) {
2289-
snapshotDeletionListeners.computeIfAbsent(deleteUUID, k -> new CopyOnWriteArrayList<>()).add(listener);
2289+
snapshotDeletionListeners.computeIfAbsent(deleteUUID, k -> new CopyOnWriteArrayList<>())
2290+
.add(ContextPreservingActionListener.wrapPreservingContext(listener, threadPool.getThreadContext()));
22902291
}
22912292

22922293
/**

0 commit comments

Comments
 (0)