Skip to content

Commit 7ffe9bd

Browse files
committed
[Ingest Manager] Fix polling for new agent action (#77339)
1 parent 1cb09d4 commit 7ffe9bd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ function getInternalUserSOClient() {
5353
}
5454

5555
function createNewActionsSharedObservable(): Observable<AgentAction[]> {
56-
const internalSOClient = getInternalUserSOClient();
56+
let lastTimestamp = new Date().toISOString();
5757

5858
return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe(
5959
switchMap(() => {
60-
return from(getNewActionsSince(internalSOClient, new Date().toISOString()));
60+
const internalSOClient = getInternalUserSOClient();
61+
62+
const timestamp = lastTimestamp;
63+
lastTimestamp = new Date().toISOString();
64+
return from(getNewActionsSince(internalSOClient, timestamp));
6165
}),
6266
shareReplay({ refCount: true, bufferSize: 1 })
6367
);

0 commit comments

Comments
 (0)